air_tebu Posted January 27, 2008 Share Posted January 27, 2008 hi, i'm trying to make a data link that only authorized person( reconized by session) can view the data this is link code <td><a href="" onclick="validate('You Are Not Autorized')">Delete</a></td> and this is java code function validate(txt) { if ( $_SESSION['MM_Username'] == $row_rs_MainTable['insrt_by'] ) { location.href = insert_data3.php?recordID=<?php echo $row_rs_MainTable['cust_no']; ?> } else [/td][/tr][/table] { alert(txt); } } Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 27, 2008 Share Posted January 27, 2008 Javascript does not handle sessions; it can handle cookies, but not sessions. You will have to validate sessions server side. Quote Link to comment Share on other sites More sharing options...
air_tebu Posted January 27, 2008 Author Share Posted January 27, 2008 how i'm suppose to do then? i'm quite blur rite now Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 28, 2008 Share Posted January 28, 2008 here is a basic server side session validation using php: http://www.tizag.com/phpT/phpsessions.php Quote Link to comment Share on other sites More sharing options...
air_tebu Posted January 28, 2008 Author Share Posted January 28, 2008 hmm, how to write function in php? its look like java cant handle the session. i understand about the session in php and already validate the session. what i need to do is, compare the user that log in(session) with $row_rs_MainTable['insrt_by']. if the user session match with the record field 'insert_by', it will open new page with url parameter. if user session not match, it will alert that user not autorized. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 28, 2008 Share Posted January 28, 2008 hmm, how to write function in php? its look like java cant handle the session. i understand about the session in php and already validate the session. what i need to do is, compare the user that log in(session) with $row_rs_MainTable['insrt_by']. if the user session match with the record field 'insert_by', it will open new page with url parameter. if user session not match, it will alert that user not autorized. you need to post php related questions in the php forum of this site. http://www.phpfreaks.com/forums/index.php/board,1.0.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.