How to Prevent Concurrent User Logins in PHP/MySQL Site?

后端 未结 6 1631
北恋
北恋 2020-12-16 18:58

I am developing the user management portion of a website that will host a webcast. The goal is to prrevent the same user nam (email address) from being used concurrently.

6条回答
  •  半阙折子戏
    2020-12-16 19:43

    How are you doing user sessions on the server? If you store them in the db, you could query the active sessions anytime someone attempts to log in and see if they're already in there. Of course you'd probably also have to check some kind of timestamp since you're not guaranteed that sessions will disappear at session.gc_maxlifetime.

提交回复
热议问题