RE: [PHP] Sessions, Cookies, and Subdomains

From: Date: Tue, 03 Dec 2002 01:16:53 +0000
Subject: RE: [PHP] Sessions, Cookies, and Subdomains
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-126786@lists.php.net to get a copy of this message
[snip] > I want to have my website split into several > subdomains with a shared user system. That is to say that when someone > logs into > foo.mysite.com they'd also be logged into bar.mysite.com when they go to > it. It is my understanding that php sessions will not work in this way, > being that each subdomain has its own sessions. If this is the case, is > there a > way around this? If it is the case and there isn't a way around this, is > this able to be done with regular cookies? You'll want to implement your own session handler and store the data in a database. Then you can access and load the session variables from any domain with access to the database. > Also, php sessions only last a > certain amount of time. I'd like for users to remain logged in > indefinitely if > they choose to do so while logging in. Assuming this is absolutely > impossible in sessions, is it feasible to use php sessions as the basis of > my user system, but use cookies as a secondary to it if users choose to > remain logged > in? Any help at all would be really appreciated, because I'd like to get > the new version of my site rolled out soon. If you want a "remember me" feature, then you'll have to implement something with cookies. Sessions will remain active as long as the user is active. If they are inactive for a certain amount of time (which you can set in php.ini) then their session file will be erased. Hope that helps. ---John Holmes...

« previous php.general (#126786) next »