I have a interactive web site that has authors. When an author enters the site on www.mysite.com and logs in, the session varible becomes
$_SESSION[loggedid]
Use this: http://ca3.php.net/session_set_cookie_params To set the domain to match all subdomains do this:
session_set_cookie_params($lifetime, '/', '.domain.com');
You need to use that before a calling session_start().
You could use this code example taken straight from the link above, which let's you keep all the current settings except the domain:
$currentCookieParams = session_get_cookie_params();
$rootDomain = '.example.com';
session_set_cookie_params(
$currentCookieParams["lifetime"],
$currentCookieParams["path"],
$rootDomain,
$currentCookieParams["secure"],
$currentCookieParams["httponly"]
);
session_name('mysessionname');
session_start();