Jump to content

login user only one device at a time


suraj

Recommended Posts

Suggestion.  When a user logs in successfully post a record of it in a separate table, say 'active_users'.  Then when they try and login again, check if they are already active (in that table), and if so, delete them and continue on to the normal login process.

Your 'active_users' table may need a datetime value in it that allows for a record to expire and be automatically cleaned up by a separate process, perhaps a cron job that runs once a day or something.

Link to comment
Share on other sites

If you want a more persistent login than solely relying on PHP sessions, save a random token to the db and store it in a cookie.  If the user shows up in a different PHP session, check the token against the latest active stored in the db.  If they differ, scrap all logins for that user and point them towards the login.

Link to comment
Share on other sites

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.