Forum Moderators: coopster

Message Too Old, No Replies

Multiple Domain Sessions

Access a SESSION array created on www.mydomain.com via sub.mydomain.com?

         

Sekka

2:28 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



Hey.

I have a website located at www.mydomain.com. I have a sub-domain located at sub.mydomain.com and I want it to be able to access a SESSION array set by www.mydomain.com within the sub-domain. My server won't allow this as they are different domains, therefore, different sessions.

Can I set my server to allow both domains to access the same SESSION? If not, what is the best way to pass it over? POST?

Thanks

Note: I am running a dedicated server with Lunix and Plesk incase I need to change anything. :)

delboy1978uk

2:35 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



i think that might work if you went by the IP address and not the domain name, but don't quote me on that, I have enough session cookie worries of my own.

You dont by any chance use dreamweaver?
i created a session cookie on a page which updates a record and goes to the next page, but you cant access the session from there on - it works fine when there is no update query involved..

Sekka

4:05 pm on Jun 29, 2006 (gmt 0)

10+ Year Member



I'm not sure if this is possible, but can you pass the PHP SESSION ID via POST and set the session on the sub-domain to the passed session?

Sekka

8:11 am on Jun 30, 2006 (gmt 0)

10+ Year Member



Ok, this is kind of what I am talking about.

[webmasterworld.com...]

Except, how can I make it so a SESSION is set and used in the main domain and the subdomain aswell?

Thank you!

proper_bo

9:02 am on Jun 30, 2006 (gmt 0)

10+ Year Member



Sekka,

I use the following method which works for my sites.

session_set_cookie_params(0 , '/', '.example.com');
session_start();

The .example.com means it will work for anything ending in example.com

don't forget the . before the domain name though!

Sekka

9:12 am on Jun 30, 2006 (gmt 0)

10+ Year Member



Why is the "." so important out of interest?

proper_bo

10:01 am on Jun 30, 2006 (gmt 0)

10+ Year Member



if you used example.com it would mean ONLY example.com

.example.com means example.com AND any subdomain there of