Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
09-24-2005, 12:06 PM #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 12:18 PM.
09-24-2005, 03: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:
this always works fine, i did try multiplying this by 100 though as a test, and I encountered the same problem as you.PHP Code:
$cookietime = time()+(60*60*24*365);