问题描述
我在一所大学工作,我正在实现一个 PHP 网络应用程序,当从一台特定的计算机访问它时,它需要具有不同的行为.我遇到的问题是,从网络服务器,使用 $_SERVER['REMOTE_ADDR'] 和 gethostbyaddr(),我只能识别计算机正在运行的路由器通过,而不是特定的计算机名称.
I work for a university, and i'm implementing a PHP web app that needs to have different behavior when it is visited from one certain computer. The problem i am running into is that from the webserver, using $_SERVER['REMOTE_ADDR'] and gethostbyaddr(), i can only identify the router that a computer is going through, and not a specific computername.
无论如何我可以设置那台特定的计算机来向服务器标识自己的身份,以便服务器知道何时从该机器访问 webapp?计算机在 kiosk 模式下运行 firefox,因此允许使用插件或油脂猴脚本...
Is there anyway i can set that one specific computer to identify itself to the server so the server knows when the webapp is being accessed from that machine? The computer is running firefox in kiosk mode, so addons or greasemonkey scripts are allowed...
推荐答案
您可以设置 cookie.这将被客户端记住并作为每个请求的一部分传输到服务器.更多信息请访问:http://www.w3schools.com/PHP/php_cookies.asp
You can set a cookie. This will be remembered by the client and transmitted to the server as part of every request. More information here: http://www.w3schools.com/PHP/php_cookies.asp
这篇关于唯一标识一台计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!