且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

限制同一用户从另一台PC同时登录

更新时间:2023-12-05 09:39:10

关于第五点,您需要确保如果用户已登录,则会话超时-假设为15分钟.并阻止用户登录15分钟.如果用户做了一些工作,请增加数据库中的会话时间(如滑动到期).这样,您只存储用户的上次激活时间,如果超过15分钟,则将其进行比较.如果少于15分钟,请提示用户他/她必须等待X分钟(其中X是使会话过期的剩余分钟).第15分钟后,您可以允许用户.
For the 5th point, you need to make sure that if the user has logged in, keep a session timeout of - lets say 15 minutes. And block the user from logging in for 15 minutes. If the user does some work, increase the session time (like sliding expiration) in the database. In that way you just store the last active time of the user and compare it if it is greater than 15 minutes. If it is less than 15 minutes, prompt the user that he/she has to wait for X minutes (where X is the remaining minutes to expire the session). After the 15th minute, you can allow the user.