Session Array Different On Different Pages With Same SESSID

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
Crashin
Forum Contributor
Posts: 223
Joined: Mon May 06, 2002 3:42 pm
Location: Colorado

Session Array Different On Different Pages With Same SESSID

Post by Crashin »

Sorry to be thick, but could someone explain to me why this is? I've got two different authentication systems on my site: one for a shopping cart/ordering system, and one for a support/product system. I register session variables for each, to keep track of the user's login status, shopping cart contents, etc.

My problem is I'd like to access session variables from one area in another, however the session variables from one aren't available in another. I've checked the $_SESSION array on the respective pages and it only contains the variables for the area in which I am at that time. I've checked the session ids to make sure they are the same in both areas (via session_id()) and they are the same session.

Lastly, I can go freely back and forth between the shopping cart and the other area and their respective session variables are retained and available.

I'm baffled.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

are these under different sub-domains? depending on your session settings, and if the sessions are started on differing subdomains, the domain setting will vary, and thus create 2 differing cookies.
User avatar
Crashin
Forum Contributor
Posts: 223
Joined: Mon May 06, 2002 3:42 pm
Location: Colorado

Post by Crashin »

Thanks for they reply, Feyd. No, they aren't under different sub-domains. Both directories, and both sessions, are under the same main domain.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

then there's no need (generally) to set the domain argument. You still need to set the path argument though.
Post Reply