Forum Moderators: coopster
The story is the following, typical e-commerce web site with shopping cart, bank connection etc., except from the domain I also created some subdomains which are also a big part of the system, all authorization procedures and session variables are done in the domain, 3 variables are created and passed from page to page once the user is logged in successfully. HOWEVER, when the user goes to a subdomain the sessions are gone...but if he goes back to the domain by clicking a link the sessions are there again and he is logged in, i have never worked with session variables in a multi-subdomain environment before and I feel very frustrated...Why do session variables dissappear when i go to a subdomain of the site-portal...please help me, any suggestions will be appreciated.
Thank you in advance
you can make your session cookies carry across all subdomains if you like. and yes, www is considered a subdomain.
PHP Code:
// note how i put a . before your domain name,
// it acts as a wildcard to the browser.
ini_set('session.cookie_domain', '.example.com');
session_start();
I dont know why and i am still seraching for a solution but havent found somtehitng that works...very sad, so much time spent and no solution, do you have any other suggestions? (Also tried with .htaccess but nothing)
[edited by: coopster at 2:41 pm (utc) on June 8, 2006]
[edit reason] generalized domain [/edit]
I would assume you are indeed using cookies by the looks of things and the explanation of your problem. Although you aren't using the PHP setcookie() function you should know that sessions still indeed set cookies if you have your server configured as such.
I told you this works but is a bad practice
you will be better of following Coopster's lead!