note 33554 added to function.session-destroy
| From: | staypuffinpc at hotmail dot com | Date: | Mon, 30 Jun 2003 14:59:22 +0000 |
| Subject: | note 33554 added to function.session-destroy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51217@lists.php.net to get a copy of this message | ||
A little more on destroying the session cookie:
I've tried everything everyone here has suggested as far as destroying cookies go and none
of them has worked for me. That is, I can destroy all session variables, but since the cookie stays
on the user's computer, I can still get to pages I should only be able to get to after logging
in even if I've logged out. My solution is more of a work-around than a solution. When
unsetting the cookie and session variables, I changed the cookie to ""(nothing) by typing:
setcookie('myCookie',"", time()+60*60*24*120);
then, in my authentication function, I added this:
if (!session_is_registered("myCookie") or ($myCookie==""))
I know this doesn't actually get rid of the cookie, but since it destroys all the information,
it does the same thing. (in case you're wondering why I didn't change the expiry,
it's just because I didn't need to in order for this to work, but you should probably
change the expiry as well) Hope this helps!
----
Manual Page -- http://www.php.net/manual/en/function.session-destroy.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33554
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33554&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33554&report=yes