Session variables return completely after unsetting.
Posted
by RemiX
on Stack Overflow
See other posts from Stack Overflow
or by RemiX
Published on 2010-05-04T10:09:06Z
Indexed on
2010/05/04
10:28 UTC
Read the original article
Hit count: 157
I have a script that should log the user out of the site. It unsets all $_SESSION and $_COOKIE variables related to the login data of the user. But somehow, it seems impossible to log out. I checked the $_SESSION array at the end of the logout script, and at the beginning of each page. At the end of the logout script it says 'array()', but when I click the home button - or any link on the site - the full session data is back again and I don't know where it comes from. This is how I try to unset the session data:
unset($_SESSION);
unset($_COOKIE["usid"]);
unset($_COOKIE["pw"]);
unset($_COOKIE["adm"]);
-- I don't know how to put it on different lines, but it's not that hard to read.
Why do these data keep coming back?!
© Stack Overflow or respective owner