chichi29 Posted March 1, 2009 Share Posted March 1, 2009 i just want to ask... >how to disable the user to use browser's back button upon logging in? >how to restrict the user to go back to a page after logging out? :its for our thesis....please help. thanks.. Link to comment https://forums.phpfreaks.com/topic/147401-about-login/ Share on other sites More sharing options...
dad00 Posted March 1, 2009 Share Posted March 1, 2009 i dont think you can actually disable the back button Link to comment https://forums.phpfreaks.com/topic/147401-about-login/#findComment-773689 Share on other sites More sharing options...
dropfaith Posted March 1, 2009 Share Posted March 1, 2009 i dont suggest doing this http://www.htmlgoodies.com/tutorials/buttons/article.php/3478911 not secure as its javascript can be turned off 1) You can use the location replace method when changing the location. This replaces the current history location with the new location. However older browsers do not support this method, which is why it is required to test for the images object: <script language="JavaScript"><!-- if (document.images) location.replace('http://www.somewhere.com/apage.html'); else location.href = 'apage.html'; //--></script> im no javascript wizard but i think that might work out as i said tho it isnt the best practice and i wonder why you would want to do it Note: in Opera replace() will work, but only with absolute URL's. .... also if your using sessions then just have logout destroy the session then pressing the back buttons will not access the data add this to the pages <?php session_start( ); if(!isset($_SESSION["username"])){ header('Location: /login.php'); } else { ?> Page goes here }?> Link to comment https://forums.phpfreaks.com/topic/147401-about-login/#findComment-773692 Share on other sites More sharing options...
dropfaith Posted March 1, 2009 Share Posted March 1, 2009 session destroy <?php session_start(); if( session_unregister('loginid') == true && session_unregister('username')==true ) { session_destroy(); header('Location: index.php'); } else { unset($_SESSION['loginid']); unset($_SESSION['username']); session_destroy(); header('Location: index.php'); } ?> Link to comment https://forums.phpfreaks.com/topic/147401-about-login/#findComment-773694 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.