RE: Setting cookie for two domains.

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

 



Shafiq Rehman wrote:
> 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.

My Sat TV provider uses something like what you want to allow me to navigate
through their website and the websites of different channels without having
to login on each website.

Basically how I think they do it:
- They have a database with the subscriber information which is shared by
all the sites.

- When you login, a popup window open (if popups are disabled it happens in
your main window) which jumps from domain to domain and set the cookie with
your session id.

- When you logout the database does no longer contain the session id. The
cookie is still set but the site checks the validity of the session id and
if it is not valid anymore then you have to login again.

So basically:

After login you set the session cookie then open a page on the other domain
passing the session id to it with GET / POST. That page sets the cookie for
that domain and sends the user on in the process.

When you logout you can then unset the cookie on the domain and open a page
on the other domain to unset the cookie or simply invalidate the session id
in a database. If you do this you need to check if the session id is still
valid when you open a page.

The actual session data should then be in a database (or similar) accessible
by both domains.

Hope it helps

Albert

List replies only please!!

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.13/221 - Release Date: 2006/01/04
 

-- 
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