...

View Full Version : setcooking(), expires never - how?



kaisellgren
09-28-2006, 02:29 PM
How would you make cookies to never expire? If you set it to 0 it will destroy after the session is gone. And negative values don't work?

raf
09-28-2006, 03:16 PM
setcookie ("TestCookie", "", time() + 60*60*24*365*100);

will make the cookie expire after 100 years.

kaisellgren
09-28-2006, 03:26 PM
I set my cookie to expire in one year. Thanks for reply, I were looking for unlimited expiration, but seems it's impossible. Anyways, most browsers would have deleted the old cookies anyway...

raf
09-28-2006, 03:32 PM
"unlimited expiration" as such is, afaik, not possible and probably not usefull. but you can achieve the same by setting the expirationdate unrealistically far in the future.

marek_mar
09-28-2006, 04:29 PM
There is no guarantee that the cookie won't expire after the user ends his session. He may have just set them to expire anyway (usefull for public computers).

raf
09-29-2006, 08:30 AM
there's even no guarantee that the cookie will ever be realy set because he can adjust his clock and set it a few years in the future... or he can just refuse cookies altogether...

rafiki
09-29-2006, 11:26 AM
reguler cookie deleters do exist :P

marek_mar
09-29-2006, 12:40 PM
You can check if an user accepts cookies by checking if it's set on the next page. You just have no guarantee that they will be set as long as you want.

raf
09-29-2006, 12:49 PM
i think this thread is getting a bit silly.

the answer to the original question is long reached --> you can only set the expiredate way in the future.

marek_mar
09-29-2006, 12:54 PM
You're right. No reason I should care if nobody else does.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum