Session Trouble (session gone when navigate elsewhere)

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
nyfael
Forum Commoner
Posts: 32
Joined: Thu Sep 21, 2006 2:28 am

Session Trouble (session gone when navigate elsewhere)

Post by nyfael »

Hi all,

I'm having a slight session problem. My sessions will hold as long as I am in the same domain or subdomain, but as soon as I navigate out of it (even from a subdomain to the domain), it disappears.

I want my sessions to hold for 30 minutes, would I make this a cookie instead of a session? But as I knew it, sessions are supposed to hold until you close the browser. Am I incorrect in this assumption?

-Kerry
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

PHP Sessions (normally) use cookies to keep track of users between page loads and match them up with their session data (which is stored on the server side). http://us2.php.net/manual/en/function.s ... params.php should help solve your problem.
Last edited by aaronhall on Thu Sep 21, 2006 3:12 am, edited 1 time in total.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Sessions are bound to a particular domain. They won't work across different domains unless you set the cookie up to work like that. Try reading the manual for session_set_cookie_params().

EDIT: Bah.. too slow! :)
nyfael
Forum Commoner
Posts: 32
Joined: Thu Sep 21, 2006 2:28 am

Post by nyfael »

haha, thanks :)
Post Reply