Re: Setting cookie for two domains.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shafiq Rehman wrote:

> Hi,
> 
> How can I register a session or cookie for two domains. I want to maintain
> logged user's state when he goes from one domain to other domain.
> 
> Example
> Suppose a user is logged in on domain1.com. A cookie is set and user is
> authenticated from database on the basis of that cookie. When he goes from
> domain1.com to domain2.com, I want he remains loggedin on domain2.com. I
> do not want any query string. Is it possible by playing with cookie or
> session settings?
> 
> Please advise if anybody has faced such problem.

I don't know exactly what you are looking for, but if you have control over
the URLs of both domain 1 and 2, you can use the session ID as a URL
parameter and do something like this:

$sid = $_GET['phpsessionid'];

if(!$sid)
 # check cookie and continue as normal
else
 # use $sid as your session ID  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux