ypran Posted May 7, 2008 Share Posted May 7, 2008 I have written the php code for login and redirected page. When the user logout from his account and if he clicks back button then i need to check whether the user is logged in or not? How can i make the page validate on back button hit? Link to comment https://forums.phpfreaks.com/topic/104540-page-validation/ Share on other sites More sharing options...
gnawz Posted May 7, 2008 Share Posted May 7, 2008 Hi I really don't know what u mean by "How can i make the page validate on back button hit" but you can manage your login using sessions and/ or cookies. Get back if you run into trouble Link to comment https://forums.phpfreaks.com/topic/104540-page-validation/#findComment-535120 Share on other sites More sharing options...
Fadion Posted May 7, 2008 Share Posted May 7, 2008 Yep as said above, ull need sessions or cookies to handle login state. So a simple example should be: login <?php session_start(); if($login){ //this is your login validation $_SESSION['login'] = true; } else{ echo 'The username and password are incorrect'; } /> session check on other pages <?php session_start(); if(isset($_SESSION['login'])){ //show some info } else{ die('You must be logged in to access this section'); } ?> Link to comment https://forums.phpfreaks.com/topic/104540-page-validation/#findComment-535122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.