[nycphp-talk] deleting cookies
Peter Sawczynec
ps at sun-code.com
Mon Jan 28 22:34:58 EST 2008
Try setting the cookie cancellation time to something more extreme like:
setcookie( 'loginID', '', time() - 31536000 );
...this issue is vaguely familiar in that it may have something
to do with the time(s) at server(s)/desktops(s) being out of synch and
that
one hour set back of cookie date is not sufficient for all involved
to see it as expired(?!)(Hunh?).
Peter
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Michael Southwell
Sent: Monday, January 28, 2008 9:45 PM
To: talk - nyphp
Subject: [nycphp-talk] deleting cookies
I'm having trouble getting some cookies deleted.
I'm storing login data in the session, and setting a two-week loginID
cookie to bypass the need to login again upon later visits. The logout
script uses the following code to destroy the session (which works) and
to attempt to delete the session and loginID cookies. But that is not
working, and those cookies are still alive if the user navigates away
from the logout page to another page, so she is automatically logged
right back in just as if she were coming back a week later.
================
session_start();
$_SESSION = array();
setcookie( session_id(), '', time() - 3600 );
session_destroy();
setcookie( 'loginID', '', time() - 3600 );
================
What am I doing wrong?
--
=================
Michael Southwell
Vice President, Education
NYPHP TRAINING: http://nyphp.com/Training/Indepth
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
More information about the talk
mailing list