session valid in other sub-domain

A

Anonymous

Guest
I've got a couple of sites running on different subdomains, but the same domain.
something like this:

http://www.mydomain.com
sub1.mydomain.com
sub2.mydomain.com

When I start a session in one of those, that session is only valid in that session. How do I make the session valid for the entire "mydomain.com" domain?? so that variables in the session are available in all subdomains?

Greetz Daan
 
nobody got any idea??

problem should be solved when the cookie, wich the session automaticly sets, appears in every subdomain.
so if I start a session in sub1.domain.com and then go to sub2.domain.com the cookie set by the first session appears there.

Greetz Daan
 
Just found it out myself:
Code:
$cookie_settings = session_get_cookie_params();
session_set_cookie_params ($cookie_settings['lifetime'],'/','yourdomain.com');
session_start();
This will make the session work throughout any subdomain you want.
lifetime stays the same this way.

Great monologe if I may say so myself ;) :mrgreen:

Greetz Daan
 
Back
Top