Jump to content

Stop users logging in twice.


Beauford

Recommended Posts

I want to stop users from logging in twice. I have set up a table with the user id and timstamp and it works fine, where I am confused is how I check it.  First, does the time need to be updated on every page, and in the crontab what am I looking for? 

 

For example, if I set the crontab for for 5 minutes and check the time against it, the user could just wait 6 and login again - defeating the purpose.

 

Am I making any sense, or just missing something simple here?

 

I guess I could set it to log the user out after the 5 minutes if there is no activity, then they could log in again.

 

Any suggestion are appreciated.

Link to comment
https://forums.phpfreaks.com/topic/129328-stop-users-logging-in-twice/
Share on other sites

so you want the same user not to be able to login twice at the same time?

what i would say is but a timestamp in the database when the user loads a new page update the timestamp.

every time the user logs in check the timestamp. if 5 mins has gone past since last recorded time then assume the user has left your site and come back.

if it is less than 5 mins then there might be two people with the same password.

this could annoy people though if browsing the browser accidentally crashes they have to wait 5 mins to use your site.

 

Scott.

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.