note 21242 added to ref.session

From: Date: Sat, 04 May 2002 18:27:38 +0000
Subject: note 21242 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-30189@lists.php.net to get a copy of this message
I am using W2K, PHP 4.2.0, Apache 2.035. Does the hitting the back button result in Session vars being maintained back to the original login page? Once a user logs in, the secure page is accessible, but when the user hits the <back> button in his browser, I want to show that he has already logged on and instead of displaying the logon form again, I want to display a logout form. I have added the following code to the "index.php" page to detect if the session vars have been set: session_start(); if (!isset($_SESSION['loggedin'])) {//loggedin set to 1 //show login form }else{ //show logout button } The login page sets up a new session then redirects (correctly) to another secure page. The code for login script is: if(authenticated){ session_start(); $_SESSION['loggedin'] = 1; //prints out corect val for $_SESSION['loggedin'] //redirect to secure page }else //redirect to error page } Any help would be greatly appreciated. -- http://www.php.net/manual/en/ref.session.php http://master.php.net/manage/user-notes.php?action=edit+21242 http://master.php.net/manage/user-notes.php?action=delete+21242 http://master.php.net/manage/user-notes.php?action=reject+21242

« previous php.notes (#30189) next »