-----Original Message----- From: Angelo Zanetti [mailto:angelo@xxxxxxxxxxxx] Sent: 24 August 2009 04:30 PM To: 'Nitebirdz'; php-general@xxxxxxxxxxxxx Subject: RE: SESSIONS lost sometimes -----Original Message----- From: Nitebirdz [mailto:nitebirdz@xxxxxxxxxxxxxxx] Sent: 20 August 2009 02:58 PM To: php-general@xxxxxxxxxxxxx Subject: Re: 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? http://www.oscarm.org/news/detail/1877-avoiding_frustration_with_php_session s http://www.webmasterworld.com/forum88/8486.htm 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? Thanks Angelo Hi all, 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. The solution. 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: if (isset($_POST['sessionID'])) { //http://stackoverflow.com/questions/441496/session-lost-when-switching-from -http-to-https-in-php // Retrieve the session ID as passed via the GET method. $currentSessionID = $_POST['sessionID']; //echo $currentSessionID; // 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. Regards Angelo http://www.elemental.co.za http://www.wapit.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php