Sessions, Cookies, and Subdomains
| From: | Rob Paxon | Date: | Tue, 03 Dec 2002 00:14:45 +0000 |
| Subject: | Sessions, Cookies, and Subdomains | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-126780@lists.php.net to get a copy of this message | ||
Hello, I've a bit of a problem and was wondering if anyone out there can help straighten it
out. I have never worked with cookies or php sessions before as the need for such has never
presented itself before. Up until this
point I have been using a very customized version of PostNuke but things are to the point where I
need a custom system from scratch. I want to use php sessions for my user system because they seem
to be more transparent to the
visitor, but there are a few problems that I think I am going to run into based on what I've
read. 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? 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.