[H-GEN] PHP Question

Greg Fairbrother greg at greg.hm
Wed Jun 4 15:34:15 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

> I'm getting a strange error when using PHP session and hopefully someone
> here can help me find out why it is doing it.
>
> I have a functions called login($username,$password) and logout().
>
> I login fine, it sets the session variables correctly. I then logout
> with -
> function logout () {
>         unset($_SESSION['authdata']);
>         print_r($_SESSION['authdata']);
>         return true;
>         }
>
> The print_r returns nothing. I then go back to log in and somehow the
> $_SESSION['authdata'] is now set.
>
> Any ideas would be greatly appreciated.

This is from the PHP language reference:

If a globalized variable is unset() inside of a function, only the local
variable is destroyed. The variable in the calling environment will retain
the same value as before unset() was called.

It may be that session vars are included in globalized variables

maybe you could try:

session_unregister("authdata");

hope that helps

Greg

> Kris Amy
>


--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list