Re: No cookie is being set?

From: Date: Sat, 03 Jan 2004 06:40:16 +0000
Subject: Re: No cookie is being set?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-173673@lists.php.net to get a copy of this message
Hi all, and thanks for all your kind hel. I found the problem although I don't know what was causing it. I simply moved the setcookie() function to another page (standalone to say) and it worked perfectly... my "Cookies" folder started to show/delete the cookie on each request, and also the site could make use of it with no problem. Why you ask? I don't know. I remember reading a long time ago that in some cases the code was read by the server from the bottom up in some case, but I don't know if this is the case... There was NOTHING that altered the setcookie() function above it. Cesar Aracena "Chris Shiflett" <shiflett@php.net> escribió en el mensaje news:20040102211926.18341.qmail@web14308.mail.yahoo.com... > --- Cesar Aracena <lists@icaam.com.ar> wrote: > > I have the following code to first start a session and then write a > > cookie... is that so hard? > > Not hard at all. However, when trying to identify a problem, it is much > easier to try to isolate it. Forget the session, and see if you can set a > cookie: > > <? header('Set-Cookie: foo=bar'); ?> > > Try to read it on another page: > > <? echo $_COOKIE['foo']; ?> > > If that works, slowly modify it until it is identical to the code in > question, testing after each step. > > Also, make sure the URL you are spcifying in the Location header is an > absolute URL. And, if you are on IIS, the Location header (and response > status code change) might be what is causing the problem, as IIS has a > known bug related to this. > > Hope that helps. > > Chris > > ===== > Chris Shiflett - http://shiflett.org/ > > PHP Security Handbook > Coming mid-2004 > HTTP Developer's Handbook > http://httphandbook.org/

« previous php.general (#173673) next »