peacemaker Posted August 27, 2009 Share Posted August 27, 2009 Hi i am new to this forum,my problem is i need to know how can i prevent user from viewing back page again. Wats happening is , when user logout then i kill session with following functions session_start(); session_unset('valid'); session_destroy(); setcookie('valid'); header('Location:index.php'); but here the cookies and the session remain maintained. after this if user press back button , it should redirect to login page. Its not happening as the session remain maintained. Can any one guide me plz , this is project is uploaded and giving me problem, so can any one help me out. Thanks . i am giving my code for checking the validity of the session variable code as below if(empty($_SESSION['valid'])) { header('Location:index.php'); } else { remaining code for displaying text box for login } i want to check this code on every page so that user should not enter into the admin or the pmpage. Quote Link to comment https://forums.phpfreaks.com/topic/172093-preventing-from-going-to-bak-page/ Share on other sites More sharing options...
MadTechie Posted August 27, 2009 Share Posted August 27, 2009 When the back button is used the browser loads the cached page try this, to stop any cacheing <?php // Date in the past header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/172093-preventing-from-going-to-bak-page/#findComment-907372 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.