>Can anyone tell me why the following setcookie()s fail?

>$expDate = mktime(12, 50, 30, 6, 20, 2010);
>setcookie("tzusercookie", $uid, $expDate);
>setcookie("tzpasscookie", $password, $expDate);

Among other stupidities, some versions of IE require that you provide *both*
date and directory, or *neither*, but not just the date.

In addition, Cookie expirations more than 2 years in the future are assumed
by some browsers (and by the Cookie spec) to be BOGUS, so 2010 is going to
mess up some browsers.

It's also a Bad Idea to bury 2010 in there anyway.  What's gonna happen if
this code actually survives through 6/20/2010?  Bam!  It breaks for no
apparent reason and some poor schnook (maybe you) has to go figure out why. 
Use $expDate = time() + 60*60*24*365*2; for the maximum two-year Cookie
time-out.  (Roughly two years, natch.)

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to