PHP - How to prevent user from logging in from multiple machines at the same time?

前端 未结 5 451
情书的邮戳
情书的邮戳 2020-12-22 07:30

Is there a way that I can prevent a user from logging into a system from different machines at the same time?

Thank you

5条回答
  •  旧巷少年郎
    2020-12-22 08:06

    I would suggest keeping track of the current (last) IP that the user logged in from. When the user logs in, change that IP. Make checking current IP against the last IP part of your authentication procedure; if it's different, log them out. The can then log back in, but that'd result in kicking the other machine's login off.

提交回复
热议问题