Re: multiple domains using one cookie

From: Date: Thu, 05 Jul 2001 18:59:41 +0000
Subject: Re: multiple domains using one cookie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56361@lists.php.net to get a copy of this message
Actually, that's not entirely accurate. You can set cookies for multiple domains on one HTML page -- you simply have to write a page that calls one image from each domain that you want to set a cookie on, even if that image is nothing but a 1x1 transparent gif. Cookie management and updating will be a challenge moving forth, but you should get the result you're looking for. --kurt ----- Original Message ----- From: "Mark Maggelet" <maggelet@mminternet.com> To: <tobias@talltorp.com>; <php-general@lists.php.net> Sent: Thursday, July 05, 2001 11:45 AM Subject: Re: [PHP] multiple domains using one cookie On Thu, 5 Jul 2001 14:59:19 +0200, Tobias Talltorp (tobias@talltorp.com) wrote: >Hello all. > >I want multiple domains to be able to read from one cookie, or set >one >cookie each for the different domains. > >Here is the case: >When the user logs in to my server, I want to set a cookie that has >the >value $name="tobias". He specifies which domains that can read this >cookie, >something like $domains="domain1.com;domain2.com;domain6.com". >Then these sites can read the $name and print it. > >The other way might be to set one cookie with the value >$name="tobias" for >domain1.com, one for domain2.com and one for domain6.com. >But the cookie _has_ to come from domain1.com, otherwise it will >only work >for mydomain.com, right? >In other words, I can´t set, edit or read a cookie for an other site? > >How would I go about doing this? right, you can't do it. the browser won't accept a cookie for a domain other than the one it's coming from, and it won't send a cookie for a domain other than the one that's being requested. a couple of ideas for a workaround would be: 1) you can set a cookie on domain1, redirect to a page on domain2 which sets another cookie, redirects to domain6 and sets another cookie and redirects back to domain1 (messy) 2) you can restructure your domains into subdomains like so: www1.domain.com www2.domain.com www3.domain.com these will all get and send cookies for domain 'domain.com' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#56361) next »