Newbie: Ending Sessions

From: Date: Wed, 16 Jan 2002 16:58:39 +0000
Subject: Newbie: Ending Sessions
Groups: php.general 
Request: Send a blank email to php-general+get-80756@lists.php.net to get a copy of this message
Hi, I wonder if someone could tell me what I am doing wrong with the following? I am trying to end a session (logout), but am having a problem... I register a new session as follows: authenticate.php (snippet) ---------------------------- // if the user has just tried to login if ($username && $password) { // if the user is present in the database, register the username in the session if (login($username, $password)==1) { $valid_user=$username; session_register("valid_user"); } } ---------------------------- ^ This works okay. BTW, session_start() is present - just not shown above. I then have a hyperlink to a logout function: logout.php (snippet) ---------------------------- session_start(); include("sasdap_fns.php"); $result = session_unregister("valid_user"); session_unset(); session_destroy(); ---------------------------- ^ $result always returns "1", but when I return to /reload /refresh the login screen I see that I am still logged in i.e. the session is still active. Can anyone see a problem anywhere? Thanks very much in advance. - Best regards, Lee

« previous php.general (#80756) next »