Re: setcookie() is not my friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, October 6, 2005 9:11 am, Brian Dunning wrote:
> I'm trying to setcookie('username',$username,15552000) but on
> subsequent pages $_COOKIE('username') is always null.
>
> I verified that I'm setting it before any other output is sent to the
> browser. I verified that $username does have some valid contents. I
> also verified that the browsers I'm testing are set to allow all
> cookies. I do have a $username and a $_SESSION['username'] that
> contain the same data.
>
> I'm all out of ideas for where to look further to debug this - any
> suggestions?

Some Ideas:

Internet Explorer, and those that mimic its broken behaviour, require
BOTH a time AND a directory (use '/') if you are going to provide a
time.

Is 15552000 sufficiently in the future to be valid? Use time() +
(60*60*24) to be SURE.

Or avoid both these issues, and leave out the time argument for now,
making it a "session" cookie, only valid as long as the browser stays
open.

DEFINITELY configure your browser to let you confirm cookies before
accepting them, so you'll know what the cookie is getting sent.

Windows XP with Service Pack 2 has made a nightmare out of cookies, by
default no longer accepting them -- And I THINK this changes based on
your adding that new goofy compact privacy policy header Microsoft
made up.

It's gotten to the point where I just don't care if IE works or not
for the parts of some of my sites that require member login from
people who need access, and I don't really care if I lose visitors or
not in that particular area.  I just tell the users to switch
browsers, or live without the access they want.  Works so far -- they
just switch to a better browser.

-- 
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux