Ask the same site two domain names how to achieve synchronization login
I have only one site, but the binding of two domain names www.a.com and www.b.com, two domain names point to the site's top-level directory index.php, the use of www.a.com login, and then visit the www.b.com is still not logged in the state. I want to realize the user landed a, Access B is also the status of landing, how to do?
Note: Please do not talk to me ucenter, I have only one station, no forum and other messy, I just want to share the session or cookie across the domain, ask experienced predecessors to point out a road, save my detours time.
Share to:
------Solution--------------------
SSO Single Sign-on.
------Solution--------------------
Is it okay to session?
------Solution--------------------
Unfortunately, cookies cannot be cross-domain, SessionID cannot be shared, and session content cannot be shared ...
If the same domain is good to solve ...
------Solution--------------------
I think the session and the cookie can't fulfill your function!
------Solution--------------------
Should be related to the cross-domain of the session ..... Since the default session cannot be shared across domains, why don't you change the next session and use the database to store it? Rewrite session
------Solution--------------------
If it is the same sub-domain name
Www.a.com,admin.a.com, can be set by the fourth parameter of the Setcookie domain can be, the cookie through the saved SessionID also pass,
But you're a two different domain name,
can use the database storage session, the session into the database, use the time in the database out, of course, there is a drawback is that the user is a large number of times to operate the database frequently, the pressure is not small, but it's okay, you can use the cache memcache,
Use database + cache (memcache)To solve the cross-domain problem of the session (in fact, it is not a session),
Do not know what I said is useful not ...