RE: [PHP] Followup to session question / scope of session

From: Date: Fri, 19 Jul 2002 17:59:00 +0000
Subject: RE: [PHP] Followup to session question / scope of session
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-108548@lists.php.net to get a copy of this message
[snip] Anyone? I'm looking on google for help and found 2 people asking similar questions, but both got no replies. Is it not possible to pass session data across subdomains? If so, what workaround can I use to keep the user authenticated? Do I just pass the session ID in the URL? That kind of sucks. :( .... If I start a session at www.mydomain.com and want to register a session variable to keep track of the user for authentication purposes, is there a way I can use that session variable on other sites, such as my.mydomain.com and mydomain.com or anythingelse.mydomain.com? It seems to only be valid for the www. domain name, and I need it to work on all of *.mydomain.com. I could set a cookie with a value, but I don't want to risk spoofing of cookies, etc.. I'd much rather keep a registered session variable which I can check to see if it exists, and use that to authenticate. [/snip] Aren't sessions assigned according to namespace? And anythingelse.mydomain.com is not a subdomain of www.mydomain.com, they exist as parallel domains. anythingelse.www.mydomain.com is a sub domain of www.mydomain.com which is a subdomain of mydomain.com which is a subdomain of com. You could, instead of using a cookie, use hidden form fields to move the info from one domain to another that is parallel to it, but that would hose any security you had unless you used the encrypted hash versions of each in your hidden form fields to make them less readable. I don't know if I am correct on this, but it seems to me that sessions are assigned to namespaces, and therfore would not work as you wished. HTH! Jay "Sex on television can’t hurt you…unless you fall off" ************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************

« previous php.general (#108548) next »