Ask the same site two domain names how to achieve synchronization login

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.