PHP Session Problem in FF [solved]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

PHP Session Problem in FF [solved]

Post 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.
Last edited by paqman on Mon Oct 19, 2009 10:39 pm, edited 1 time in total.
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

Re: PHP Session Problem in FF

Post 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!
User avatar
Mirge
Forum Contributor
Posts: 298
Joined: Thu Sep 03, 2009 11:39 pm

Re: PHP Session Problem in FF

Post 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.
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

Re: PHP Session Problem in FF [solved]

Post 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...
Post Reply