I need a method to stop concurrent logins using PHP / MySQL.
Current setting
Currently, there are 2 people who use the same login in the system that I created inside, where I work. Due to the nature of the system, I do not want both of them to log into the system.
What i tried
About 10 articles on stackoverflow and googled as long as I can.
I also tried to add the "loggedin" field to the user table, which was set to 1 when logging in, and "0" was set when logging out. Then, if the same user credentials that are used when logging in will fail.
The problem was that if the person who logged in turned off the browser without logging out properly, he did not update the database. Then I get a phone call from this person, and I would have to reset the value 0 in the database.
This is not possible, since soon the product will be released to about 20 people.
What I need
I need to find a way that when the browser closes the script, it executes to update the database. Alternatively, a way to read every current session on the server that I could manipulate, or something else.
Limitations
Our hosting providers are terrible, and subsequently the changes that I can make on the server are limited / impossible. Hosting is a public hosting solution.
php mysql login session user-management
itsphil
source share