Reply to RE: [PHP] Setting cookie for two domains.

Your name:

Reply:


Posted by "Albert" on 10/16/25 11:36

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация