shane07 Posted January 2, 2008 Share Posted January 2, 2008 Hello to all I have a problem with my page when back button is clicked. I have set a session variable in my log-in page. e.g. $_SESSION['userid']="logged"; Similarly for log-off page, I have unset the session variable e.g. session_unregister('userid'); and used the header function and the log-in page is navigated. At this point when back button is pressed twice, a dialog box appears which asks to post the data. When OK button is clicked the previous post data is automatically posted and the user is logged in, I mean the session variable is set there. What may be the problem? Thanx for ur reply. Link to comment https://forums.phpfreaks.com/topic/84102-page-posted-automatically-when-back-button-is-clicked/ Share on other sites More sharing options...
redarrow Posted January 2, 2008 Share Posted January 2, 2008 in the url use cmd=back <?php if($_GET['cmd']=="back"){ session_destroy(); unset($session_name); } ?> Link to comment https://forums.phpfreaks.com/topic/84102-page-posted-automatically-when-back-button-is-clicked/#findComment-428093 Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2008 Share Posted January 2, 2008 you should use session_unset(); too but since you are re-posting the post variables its as good as going to the form and entering the data again... I do not see any problem in it.. however they could be security issue on shared computers... but it cannot be avoided... Link to comment https://forums.phpfreaks.com/topic/84102-page-posted-automatically-when-back-button-is-clicked/#findComment-428094 Share on other sites More sharing options...
jitesh Posted January 2, 2008 Share Posted January 2, 2008 Follow this flow of coding. (1) Login.php file // Fill up login information (2) intermediate_action.php // Here keep an intermediate action file which contains database operations , Login check , Set of session variables etc... (3) After step 2 redirect to other page like as user_account.php etc. Check the above way. Link to comment https://forums.phpfreaks.com/topic/84102-page-posted-automatically-when-back-button-is-clicked/#findComment-428095 Share on other sites More sharing options...
redarrow Posted January 2, 2008 Share Posted January 2, 2008 I had the same problam so use my method ok it works..... Link to comment https://forums.phpfreaks.com/topic/84102-page-posted-automatically-when-back-button-is-clicked/#findComment-428096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.