From: Angelo Zanetti [mailto:ang...@zlogic.co.za]
Sent: 24 August 2009 04:30 PM
To: 'Nitebirdz'; firstname.lastname@example.org
Subject: RE: [PHP] SESSIONS lost sometimes
From: Nitebirdz [mailto:nitebi...@sacredchaos.com]
Sent: 20 August 2009 02:58 PM
Subject: Re: [PHP] SESSIONS lost sometimes
On Thu, Aug 20, 2009 at 02:34:54PM +0200, Angelo Zanetti wrote:
> Hi Leon,
> No harm intended :) Just thought that people were missing my post now and
> only answering yours.
Angelo, excuse me if I'm bringing up something very basic, but I'm new
to this. Just trying to help.
I imagine redirects couldn't be the cause of the problem, right?
Hi thanks for the links it appears that its all in order also I'm not losing
SESSIONS on the redirect but somewhere else.
I have checked the garbage collection, disk space and other settings in the
PHP.ini file. ALL FINE.
So now I am really stuck and confused as to what could sometimes cause the
loss of these variables and other times it just works fine.
Is there possibly a way that I can call some function that will ensure that
the sessions are saved (I checked the manual - nothing much).
Any other ideas? Anything that you think might be causing issues?
I have solved the issue of lost session variables.
It appeared to be losing the SESSION variables when going from a POST from
HTTP to HTTPS, however it didn't always happen, so the logging allowed me to
narrow down where the losing was occurring.
In my form that I post from the HTTP site, I put a hidden variable in there
and with the session variable.
In HTTPS it sometimes doesn't carry over the hidden variable therefore we
need to start the session with the old SESSION ID from the HTTP site.
So what I did was the following on the https site:
// Retrieve the session ID as passed via the GET method.
$currentSessionID = $_POST['sessionID'];
// Set a cookie for the session ID.
$sessionid2 = session_id($currentSessionID);
Therefore setting the session ID with the session_id() function. This must
go before the session_start() function!!! Very NB!.
Hope this helps anyone who has a similar problem.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php