Forum Moderators: coopster

Message Too Old, No Replies

Permanent Cookie / Maximum Cookie Lifetime

Does anyone know how to set a permanent cookie?

         

physics

4:52 am on Apr 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried setting a cookie's duration for longer than a year and it was rejected. Does anyone know if there is some sort of workaround to make a 'permanent cookie'.

panos

12:47 pm on Apr 2, 2007 (gmt 0)

10+ Year Member



Hi physics,

This is how i set a cookie for 16 years.

setcookie("example", $cookievalue, time()+60*60*24*6004, "/", ".example.com");

Which browser rejects your cookie? IE7?
Is your server's time correct?
What kind of cookie are we talking about? http or https?

mcibor

2:31 pm on Apr 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why do you want to set such a long time cookie?
I've seen that 1 month is just about enough.

Moreover you can "refresh" the cookie on the person's next visit.

Regards
Michal