Re: Newbie: Ending Sessions
| From: | Janet Valade | Date: | Wed, 16 Jan 2002 20:40:50 +0000 |
| Subject: | Re: Newbie: Ending Sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80817@lists.php.net to get a copy of this message | ||
I'm not sure what you mean by the session is still active, but if you mean
that the variables still are set to the same values, try moving the
session_unregister after the session_unset, but still before the
session_destroy.
Janet
----- Original Message -----
From: "Lee P Reilly" <lreilly@lanl.gov>
To: "PHP List" <php-general@lists.php.net>
Sent: Wednesday, January 16, 2002 8:58 AM
Subject: [PHP] Newbie: Ending Sessions
> 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
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>