dsa5233 2013-08-26 10:57
浏览 107
已采纳

我们如何在php中为登录系统获取macid或任何其他唯一标识符

I have to build a login in the website which will be bind to a system. e.g. A user can login only through the machine he has registered.

I will not be able to get the mac id or any other unique identifier through PHP which I can bind with that login. I have hosted the website on shared hosting, So I cannot install any new library. Standard libraries are available.

Let me know if there are best possible ways to do the same.

  • 写回答

1条回答 默认 最新

  • doudao1837 2013-08-26 11:12
    关注

    There is no unique id of the machine, at all. MAC addresses don't transition network boundaries, IP addresses are not unique and volatile. Beyond that you only have what you get in the HTTP headers, which is not unique or permanent either.

    The best you can do is set a non-expiring cookie on the machine with a unique id and depend on that; i.e. make your own id. That'll create problems when the user switches browsers or machines or just cleans the cookie storage though, so make sure you have a procedure in place for this case. Cookies may also be hijacked, so prepare a procedure for this case too and transact everything over SSL secured connections to minimize the likelihood of that occurring.

    In short: everything depending on the physical machine of the user is problematic on the web, since the web is explicitly designed to be client-agnostic. Machine ids cannot be depended upon for security. Registering a machine using a unique cookie can be a useful part in strengthening traditional username/password security, but it's not a replacement.

    The best is typically to base your security on traditional usernames/passwords (+ second factor authentication if possible), and use the unique cookie as additional tool. For example, every time the user logs in from an unknown machine, you require an email/SMS feedback loop to "register" the machine.

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

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?