Login problem with php

Posted by shinod on Stack Overflow See other posts from Stack Overflow or by shinod
Published on 2010-06-08T09:44:36Z Indexed on 2010/06/08 9:52 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

I want to prevent multiple log in with same log in credentials simultaneously. So I made a column login_status and set it to 1 when some one logging in and change to 0 when logging out besides I set session after successful logged in. If user won't click on log out(in case of user close tab or because of some network problem) it doesn't update database and then one can't use that log in credentials again. So I use a ajax call to set current time stamp in database with related log in credentials and it is updated in each 2 minutes if user not navigate from that page. Then if some one attempts to log in with same log in credentials, it will check these time stamp if column login_status is 1, then if the time stamp is older than 3 minutes it allows the log in.Then it solving that problem. But the new problem is if user closes the tab or browser window and after 3 minutes one can log in with same log in credentials from somewhere and if the previous user open that page automatically it will log in as session is already set. How can I prevent this.

© Stack Overflow or respective owner

Related posts about php

Related posts about database