Reply to Re: [PHP] setcookie() is not my friend

Your name:

Reply:


Posted by "Richard Lynch" on 10/07/05 00:41

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация