Cookie Question, In Php

liunx

Guest
Okay, I've got most of the cookies down, the only thing I am left wondering at is how to set an infinite expiration date. Is it possible, or not? If not I think I could use an if statement to rest the cookie's current time back to whenever, or add onto the cookies current time. But I really hope that isn't necessary...<br /><br />What I'm trying to do is let viewers set the skin of a site (the site isn't up yet anyways so I'm on no rush). I have it in PHP, and it sets a cookie called colorTheme, and its value determines which CSS file the browser is going to use. But I need to know how to make it so it'll never expire uintil they delete it or until they click the default color scheme.<!--content-->
Can't you set the date for several years in the future?<!--content-->
If I recall correctly, there's no way to set the cookies not to expire. What you can do is, like Bruce said, set the date for several years in the future.<!--content-->
Darn...I was hoping that there was a set way in order to do it (rather than having it expire in the great future). Thanks anyways. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /><!--content-->
Slatck, but why do you need to set it to infinite? Won't an expire date in, say, 100 years do?<!--content-->
Yeah the practice is to set a cookie way into the future, and to expire it again, to set it in the past (maybe due to peoples clocks being possibly wrong I dont know, but some, such as Yahoo!, set expiring cookies several years into the past).<br /><br />It's worth remembering too, setting it 10 years into the future is no problem, what is the chance they're using the same computer, same browser, or haven't cleared their cookies in 10 years:eek:<!--content-->
I think the rule is to set to your birth year plus 200 <br />then you shouldn't have to worry about it <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--content-->
 
Top