PHP to implement an account can only one user login

Source: Internet
Author: User
Ideas:
When a user logs on, the value of the function session_id () is written to the database so that the session_id value in the database is always guaranteed to be the session_id of the most recent logged-in user.
When the page validates the user, it needs to verify that the user's current session_id and the value of the session in the database are consistent.
Example:
You are known to have an account of U, two users A and B.
First a login account U, so user a login, the corresponding session_id write to account u corresponding to the session_id, when user a remains logged in.
Then B also login account u, User B login, the corresponding session_id updated account u corresponding to the value of the session_id.
At this point, a user to verify that a corresponding session_id value and database inconsistencies, the system prompts a user, there are other users login account U.
Reference article: http://www.zhihu.com/question/19976722

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

PHP to implement an account can only one user login

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.