How to prevent repeated login by users in php

Source: Internet
Author: User
In php, how can we prevent users from repeatedly logging on to the B/s project? generally, this is difficult. in php, what do we do? , Or have had similar experience introduction can also, in special circumstances, it is best to calculate, down, power failure,..., with js. Cookie, session, header, database, and session setting are convenient. add a record in the user table to the current login s php. how to prevent repeated login by users?
The B/s project is generally difficult to solve this situation. What are the solutions of the great gods in php? , Or you have had a similar experience,

In special circumstances, it is best to calculate, shut down, power-off ,...




------ Solution --------------------
Use js. Cookie, session, header, and database
------ Solution --------------------
Easy to set session
------ Solution --------------------
Add a field in the user table that records the current logon session
When a user logs on, the current sessionID is recorded.

PHP program to verify the current login sessionID and the saved sessionID, if not, T drop the first login

This is what my system does.
------ Solution --------------------
Discussion
Add a field in the user table that records the current logon session
When a user logs on, the current sessionID is recorded.

PHP program to verify the current login sessionID and the saved sessionID, if not, T drop the first login

This is what my system does.

------ Solution --------------------
Check it on the server! Recommended session
------ Solution --------------------
The default session time is 24 minutes.
This time is not the total time, but the new time is not refreshed. for example, if the 24-minute period is minimized, you need to log on when the instance times out. in this way, normal use will not be affected, and the time can be changed.
There shouldn't be any worries
------ Solution --------------------
In session, a field is stored in the database to determine whether the user has logged on.

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.