Re: Cookie Trouble: getting the information back out...

From: Date: Wed, 26 Mar 2008 13:58:03 +0000
Subject: Re: Cookie Trouble: getting the information back out...
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-272122@lists.php.net to get a copy of this message
On Tue, Mar 25, 2008 at 9:49 PM, Andrew Ballard <aballard@gmail.com> wrote: > On Tue, Mar 25, 2008 at 9:31 PM, Daniel Brown <parasane@gmail.com> wrote: > > > > Is this block of code executed immediately after the cookie is > > set? Sometimes PHP works too fast for its own good and the client > > doesn't even realize it has a cookie yet. Try setting it with one > > page and either sleep()'ing for a bit or forcing a link-click or page > > refresh before checking for the cookie. > > Um... Cookie data ISN'T available to the same script that sets it. If > you use setcookie(), all it does is send a header to the browser > immediately ahead of the output of your script telling the browser to > store those values in either memory or on disk. The value will not > appear in the $_COOKIE array until the browser requests the next page > and includes the Cookie: header as part of the request. You're correct. I was saying basically the same thing, but re-reading it, it sure doesn't look like it in English. ;-P The sentences should've instead been rewritten like so: "Try setting it with one page and forcing a link-click or sleep()'ing for a bit and then refreshing." It wasn't meant to insinuate -- </Daniel P. Brown> Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283

« previous php.general (#272122) next »