View Full Version : Working with 2 cookies

03-13-2009, 04:35 PM
I have a site that allows people to create custom homepages.
They can choose a theme and setup custom links. All of this info is saved to a cookie.

So I guess what I want is to have a "defaultcookie" set when the user accesses the main page. Then when they set there own preferences the "defaultcookie" will be deleted, and the "usercookie" will be set.

Now if they go back to the main page I need some sort of script to check to see if "usercookie" has been set. If it has, then do nothing. If it hasn't been set, then set "defaultcookie".
Is this possible?

03-13-2009, 04:53 PM
//if usercookie is not set
//set the default cookie
setcookie('defaultcookie', 'your value here', time()+3600);//this will expire in 1hr


03-13-2009, 04:57 PM
Hey, thanks for the quick response. Awesome, I'll give it a shot.