Forum Moderators: coopster

Message Too Old, No Replies

using cookie through subdomanis (somtimes)

cookies, domains, subdomains, sometimes

         

sporb

10:18 pm on Jun 18, 2008 (gmt 0)

10+ Year Member



I have a bunch of subdomains

sub1.domain.com
sub2.domain.com
sub3.domain.com
...
sub35.domain.com

and if a user wants to be remember, i use cookies to remember them on all the subdomains. (i used session.cookie_domain in php.ini for this). my problem comes when i have cookie named 'settings' that are specific settings for each domain. because i have cookie_domain set to .domain.com the 'settings' are shared across domains.

i would like to know if it's possible to share some cookies across the domain and not share others?

i was thinking i could create a users.domain.com and set the remember cookies from that subdomain, but i don't know how (or if it's possible) to specify which subdomain you call the cookie from.

anyone who knows how to do this, or has suggestions about what i can do, i would very much appreciate your help.

coopster

2:36 pm on Jun 20, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have a look at the setcookie [php.net] function. It explains a lot of what you want to do and there is a link there to the cookie specification that you should read as well.