douxiangdiao6348 2017-03-11 12:52
浏览 16
已采纳

限制一个用户登录页面[关闭]

Restrict sign as only one user at a time on a single page (admin) across the Internet. 2 administrators. admin1, admin2. When admin1 login from Germany Admin 2 will not be able to log in from Germany, USA, Switzerland etc.

  • 写回答

1条回答 默认 最新

  • drde3456 2017-03-11 13:19
    关注

    This is possible, but how you'd do it would depend on your scenario as the approach, as always, depends on your exact requirements.

    You need to identify if someone is already logged in, which can be done in a few ways.

    You could use a specific session name for every login. When someone attempts to login, check if that session name already exists, but this makes it hard to manage problems you'll face.

    DATABASE
    You could set data in a temporary table when someone logs in, and check if this already exists when users attempt to login.
    This approach would likely be better as one of the main issues you will face is knowing if someone who is logged in is no longer using the system and so someone else logging in is legitimate.

    How you handle all this depends on your exact scenario though. eg perhaps this is in-house among a few users (say 5) and they all know that they must logout when they are done, otherwise no-one else can log in.

    Otherwise, you could update the temporary table with activity (every time they click on or do something update the activity timestamp), and if last activity was X mins/hours ago then log the other user out and new one in.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误