Page 1 of 1

PHP Session Problem in FF [solved]

Posted: Mon Oct 19, 2009 10:06 pm
by paqman
First time ever, in maybe 2 dozen websites, that FF has had a problem that IE hasn't (I'll bet it's because I'm breaking some rules I don't know about, and IE isn't catching me though...).

I've got 3 websites, all for 1 client. Each site, on a user's first visit, goes to a website selection page. It shows all 3 options, and they choose one. I've tried to synchronize session, etc, but only to get frustrated (all 3 are in the same account on the same server). I've got to this point, which works in IE but not in FF:

At the top of the main page of one of the websites, located at http://ecocity.net.au (please visit it and try it yourself):

Code: Select all

 
session_start();
if(!isset($_SESSION["checkedin"]))
{
    $_SESSION["checkedin"] = "1";
    header("Location: http://ecocityliving.com.au/select/");
    exit;
}
 
If the user hasn't seen that page before, the session variable is not set, and they are taken to that page which shows the 3 websites (currently 'City Chicks' is the one I'm working on/having this issue with). Now, when they go back to http://ecocity.net.au by clicking on the left icon, they should see the normal page and not be redirected, because the session variable is set. In IE, that is what happens. In FF, I have to click the icon twice (go to http://ecocity.net.au twice) before I see the normal ecocity.net.au webpage.

Any ideas?! I'm also open to suggestions on other ways to accomplish this same result. Thanks.

Re: PHP Session Problem in FF

Posted: Mon Oct 19, 2009 10:09 pm
by paqman
Also, just noticed in IE8 its one click, in IE7 and FF, on my machine, it needs 2 clicks.

Looked through the information transfer with Fiddler, and it looks like the session for ecocity.net.au is being restarted. On the first iteration (the first visit) the sessionid is different than the 2nd iteration (when the visitor clicks the icon and is taken back). What would cause the session to reset the first time, but not the second?

Thanks!

Re: PHP Session Problem in FF

Posted: Mon Oct 19, 2009 10:19 pm
by Mirge
Try using session_set_cookie_params(...); before your session_start() call. Sometimes I can't get sessions to work PERIOD unless I set the params... see http://www.php.net/session_set_cookie_params/ for more info.

Re: PHP Session Problem in FF [solved]

Posted: Mon Oct 19, 2009 10:40 pm
by paqman
So, turns out I was going to http://ecocity.net.au and the button was taking them to http://www.ecocity.net.au, which has a different session apparently. What a dumb mistake...