[nycphp-talk] lost sessions on redirect
Chris Shiflett
shiflett at php.net
Mon Feb 9 20:43:17 EST 2009
On Feb 9, 2009, at 20:02, Michael Southwell wrote:
> Christina Karlhoff wrote:
>> About a year ago NYPHP created a captcha form for our website. The
>> html has undergone quite a few changes. Unfortunately in that
>> process we've lost some function...when a user submits the form,
>> forgetting a required field, the session is lost; on the redirect
>> the data that was input by the user is gone. Needing some guidance
>> as to how to fix this. Help please?
>
> Carry the session id along as a get variable in the redirect,
> something like this:
> header( 'Location: somewhere.php?PHPSESSID=' . session_id() );
Probably best to determine the problem first. The Location header
requires an absolute URL, and the way you've just used it results in a
lost session on some older versions of IE. (IE correctly determines
the host for the request, but it fails to include cookies for that
host.) So, passing along the session identifier in the URL can correct
this problem, but it's a poor solution.
Christina, do you have LiveHTTPHeaders for Firefox or something like
it? If we could see the HTTP transaction in question, I'm sure the
problem will reveal itself.
Chris
--
Chris Shiflett
http://shiflett.org/
More information about the talk
mailing list