Re: sessions
| From: | Monty | Date: | Fri, 26 Jul 2002 18:03:33 +0000 |
| Subject: | Re: sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109839@lists.php.net to get a copy of this message | ||
It's because you are unregistering the valid_user variable, but, the
old_user var you defined early on still exists. So, "if (!empty($old_user))"
will equal FALSE, giving you the result you are getting. Change it to "if
(!empty($valid_user))".
Monty
> From: linuxgeek23@hotmail.com (Tyler Durdin)
> Newsgroups: php.general
> Date: Fri, 26 Jul 2002 17:33:03 +0000
> To: php-general@lists.php.net
> Subject: sessions
>
> I used this logout page using sessions a while ago and it used to work
> great, but now it doesn't work. The only thing i have changed is my version
> of php. Can someone take a look and see what i have to change?
>
> <?
> session_start();
>
> $old_user = $valid_user;
> $result = session_unregister("valid_user");
> session_destroy();
>
> ?>
>
> then a little further down i have this....
>
> <php?
> if (!empty($old_user)) {
> if ($result) {
> echo "Logged out.<br>";
> } else {
> echo "Could not log you out.<br>";
> }
> } else {
> echo "You have not logged in; therefore, you cannot logout.<br>";
> }
> ?>
> It seems to log me out still, but it always gives me the "you have not
> logged in; therefor, you cannot logout" message. i also checked it with a
> script to see if my original sessions were actually registering and it
> seemed that they were. i am stumped. Any ideas would be greatly appreciated.
> Thanks.
>
>
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>