NYCPHP Meetup

NYPHP.org

[nycphp-talk] simple problem with sessions

Jeff Siegel jsiegel1 at optonline.net
Sun Oct 10 10:41:28 EDT 2004


This would seem to bring us back to a browser-specific issue.

Jeff



Chris Shiflett wrote:
> --- Jeff Siegel <> wrote:
> 
>>But wouldn't it be the case that the user has already been
>>redirected to a different page before the script has terminated?
>>That is, when the code is:
>>
>>header('Location: otherpage.php');
>>exit;
> 
> 
> Nope, because until the script terminates, no response is sent. The
> header() function only sets an HTTP header within the response, although
> Location is a special header in which case PHP also changes the response
> status code.
> 
> The browser requests the new URL (which should be specified in the
> Location header using an absolute URL) once it receives the response, but
> prior to that, it has no idea that it's coming.
> 
> So, I've been wondering if this suggestion to use session_write_close()
> came about because of this misunderstanding about how the header()
> function works or something. That's my only guess, unless there is a
> special case that I'm unaware of.
> 
> Chris
> 
> =====
> Chris Shiflett - http://shiflett.org/
> 
> PHP Security - O'Reilly     HTTP Developer's Handbook - Sams
> Coming December 2004        http://httphandbook.org/
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
> 



More information about the talk mailing list