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. Quote 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); } ?> Quote 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... Quote 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. Quote 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..... Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.