setcookie() and Max-Age
| From: | Andi Gutmans | Date: | Tue, 17 Aug 2004 23:17:59 +0000 |
| Subject: | setcookie() and Max-Age | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-12201@lists.php.net to get a copy of this message | ||
Hey,
There's a very interesting user contributed note for the setcookie() function (Follows in the end).
I think it makes sense to support Max-Age because it fixes clock skew problems between the client and server.
Not sure if an how this could be added to setcookie() because of the already rich amount of parameters it accepts. Would it make sense to have something like setcookie_max_age() or something similar?
Andi
add a note User Contributed Notes
setcookie
mr-yellow at mr-yellow dot com
15-Aug-2004 10:14
Sorry Secure not Secure=1....
Instead of setcookie it would be much safer to use the new
better specs and send the following.
A 1 hour cookie is as follows:
header('Set-Cookie: TestCookie=something+from+somewhere; Max-Age=3600; Domain=.www.domain.com; Path=/; secure;');
To Delete a cookie set -1:
header('Set-Cookie: TestCookie=something+from+somewhere; Max-Age=-1; Domain=.www.domain.com; Path=/; secure;');
-Ben