I recently I working with a project and trying to find anyway or package to prevent multiple login on a account using laravel framework. For example, I already login and someone try to login from another device or different browser, it automatically block from that person from login. Thanks
Asked
Active
Viewed 2,788 times
2
-
4Possible duplicate of [How to prevent multiple logins in PHP website](http://stackoverflow.com/questions/1727919/how-to-prevent-multiple-logins-in-php-website) – Al-Mothafar Feb 19 '17 at 11:13
1 Answers
0
You can use the session data since that has a last_activity field. I personally use the database for sessions but maybe you can use the file storage or similar.
I link the session to a user (if they're logged in). Then I can check the last activity with that as well. You can do something similar.
For the checking
On login, do a check to see if there's an active session by that user. If so do your stuff and log out the person.
If you only want to check device, you can check browser agent/platform (and IP).
Vijayanand Premnath
- 3,415
- 4
- 25
- 42