Jump to content

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...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.