問題描述
我在一所大學工作,我正在實現一個 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
這篇關于唯一標識一臺計算機的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!