How do I set a session to work for a subdomain

How do I set a session to work for a subdomain

Postby nolag » Tue Mar 02, 2010 3:00 pm

I want to start a session in tiny2.net and have it work in both tiny2.net and you.tiny2.net but I cant seem to make it work :(. I have tried googleing it but the results don't work :(.
nolag
Sr. Member
 
Posts: 516
Joined: Fri Jan 22, 2010 9:14 pm

Re: How do I set a session to work for a subdomain

Postby coreyman » Tue Mar 02, 2010 4:07 pm

nolag wrote:I want to start a session in tiny2.net and have it work in both tiny2.net and you.tiny2.net but I cant seem to make it work :(. I have tried googleing it but the results don't work :(.



I don't think you can do that.
Part of the mean team.
coreyman
Administrator
 
Posts: 899
Joined: Sun Nov 08, 2009 3:19 pm
Location: Tyler, Texas

Re: How do I set a session to work for a subdomain

Postby nolag » Tue Mar 02, 2010 4:18 pm

Sure u can, if you go to buy something at a website like indigo.ca then u go to shop.indigo.ca and they still know who it is! The weird part is if I go to google and go back it will stay alive but if I go to a subdomain it dies!
nolag
Sr. Member
 
Posts: 516
Joined: Fri Jan 22, 2010 9:14 pm

Re: How do I set a session to work for a subdomain

Postby sdnlabs » Wed Mar 03, 2010 7:10 am

Try using cookies instead. As far as I know, sessions can't be shared through different subdomains unlike cookies.

For example, you can share the same cookie for shop.domain.com and user.domain.com
sdnlabs
Newbie
 
Posts: 60
Joined: Mon Jan 18, 2010 3:08 pm

Re: How do I set a session to work for a subdomain

Postby nolag » Wed Mar 03, 2010 2:24 pm

Interesting, I have not worked with cookies before mabey that is how the big sites do it. I guess the even better part is that no one else will no what the cookie is so if they have <subdomain>.tiny2.net they will not be able to steal the username! Can I restrict a cookie to only some subdomains? Like www. and you. (literally I am using you.)?
nolag
Sr. Member
 
Posts: 516
Joined: Fri Jan 22, 2010 9:14 pm

Re: How do I set a session to work for a subdomain

Postby coreyman » Wed Mar 03, 2010 3:16 pm

nolag wrote:Interesting, I have not worked with cookies before mabey that is how the big sites do it. I guess the even better part is that no one else will no what the cookie is so if they have <subdomain>.tiny2.net they will not be able to steal the username! Can I restrict a cookie to only some subdomains? Like www. and you. (literally I am using you.)?



Yea you can restrict the cookie to only some subdomains.
I may be wrong, but I think it has to be ONE particular subdomain that you set the cookie on, but you can set the cookie on many subdomains. You can set the cookie on all subdomains with the wildcard *.tiny2.net
Part of the mean team.
coreyman
Administrator
 
Posts: 899
Joined: Sun Nov 08, 2009 3:19 pm
Location: Tyler, Texas

Re: How do I set a session to work for a subdomain

Postby nolag » Wed Mar 03, 2010 3:39 pm

I was hoping to do 2 and not others because others will belong to other people. I will look into it. The work around is to make them go to a different page to register a non-used subdomain. I guess that could work but it's not ideal.
nolag
Sr. Member
 
Posts: 516
Joined: Fri Jan 22, 2010 9:14 pm


Return to PHP

Who is online

Users browsing this forum: No registered users and 1 guest

cron