Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
09-24-2005, 11:06 AM #1
- Join Date
- Sep 2005
- Thanked 0 Times in 0 Posts
Cookie gets deleted when the browser closes.
Whenever I close my browser the cookie gets deleted for some reason. Here's the code I use to set the cookie:
setcookie('sitename', "$uname2,$pword2", time()+2147483647);
I'm not using sessions or anything so I don't understand why this is happening. It happens in Firefox and IE so it's not browser related like I thought. I figured there must be a stupid mistake with how I'm setting it.
If you need more code let me know, but that should be the only relevant part pertaining to cookies.
I found the problem myself already. On my home install of apache/php the session.cookie_lifetime was set to 0. It worked fine on my remote server so I figured it had something to do with my apache/php configuration.
I didn't see a way to close this so I just added the solution for anyone else that searchs for the same problem.
Last edited by Username; 09-24-2005 at 11:18 AM.
09-24-2005, 02:23 PM #2
I think its becuase of the ammount of time you are trying to set the cookie for (68 years). I usually set cookies for no more than a year.... I always use an exact value by doing multiplication:
$cookietime = time()+(60*60*24*365);