How to implement synchronous login for two domain names on the same site

Source: Internet
Author: User
Tags subdomain name
I only have one website for synchronous login with two domain names at the same site. However, I have bound two domain names www.a.com and www. B .com, both of which point to the top-level directory index of the website. php: After you log on to www.a.com, it is still not logged on when you access www. B .com again. I want to know how to implement synchronous login between two domain names on the same site after a user logs on to a and B is also logged on.
I only have one website, but I have bound two domain names www.a.com and www. B .com. both domain names point to the top-level directory index of the website. php: After you log on to www.a.com, it is still not logged on when you access www. B .com again. After a user logs on to a, access to B is also logged on. how can this problem be solved?

Note: Please do not talk to me about UCenter. I only have one site, and there is no forum or other mess. I just want to share sessions or cookies across domains, and ask experienced predecessors to give me a clear path, save me time on detours. Share:
------ Solution --------------------
Search for SSO single sign-on.
------ Solution --------------------
Isn't the session okay?
------ Solution --------------------
Sorry, the cookie cannot be cross-origin, the sessionid cannot be shared, and the session content cannot be shared...
If it is the same domain, it will solve the problem...
------ Solution --------------------
I think session and cookie cannot implement your function!
------ Solution --------------------
It should be related to the cross-origin of the session ..... Since the default session cannot be shared across domains, why not modify the session and store it in a database? Rewrite session
------ Solution --------------------
If it is a subdomain name of the same level
Www.a.com, admin.a.com, you can set the fourth parameter domain of setcookie, and the cookie passes through the saved sessionid,

But you have two different domain names,
You can use the database to store sessions, store sessions to the database, and retrieve the sessions from the database. of course, this drawback is that frequent database operations are required when a large number of users are involved, the pressure is not small, but it doesn't matter. you can use the cache for memcache,
Use the database + cache (memcache) method to solve the session cross-domain problem (in fact, it is no longer a session ),

I don't know what I'm talking about...

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.