Click here to Skip to main content
14,732,999 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello people.
I want to prevent multiple log in in php application.
Firstly, I create login status(active, Inactive) in access_log table
When user A login the user status will be set to 'active', and if the user logout the status will be set to 'Inactive'. when another client tries to login using the same user account which is still active, I check the access_log table. if the user still active the error login will be sent to the user.
But the problem occurred is, if the user closes the browser. the status in access_log table cannot be updated because the user didnt click logout.
Can someone suggest me something.
Posted
Updated 28-Mar-11 21:51pm
v2

PHP is a language, not an environment or system. You haven't said anything at all about what you're trying to prevent login to, so your question is impossible to answer.
   
Since your aim is to prevent multiple login, the ideal way is to create a logout link in the redirection page if a session is found as active. In this page, you can create a procedure for logout, for instance, the person is supposed to provide certain details stored in the database which have to be validated against the database. If the information provided is correct, you can proceed and destroy the other active session and start a new one.

Note, you can accompany your login sessions with a Unique Identifier (UUID) for each login for logging purposes, together with the boolean status field. This will help you track your logged sessions.

I hope it works for you, if you find this useful, please upvote it.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900