我試圖獲得變量$_SERVER['Remote_User']
來驗證我的內部應用程序的用戶。
有沒有辦法做到這一點與PHP作爲CGI運行?
我嘗試了所有的workarrounds,我發現googeling(重寫規則,在.htaccess中設置變量,然後爆炸b64編碼的字符串)。
或者是否有一些其他奇怪的方式來獲取訪問我的網站的用戶名?
這裏是一個打印出我的$ _ SERVER數組:
Array
(
[HTTP_HOST] => tnxp.telenor.net
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_CONNECTION] => keep-alive
[HTTP_CACHE_CONTROL] => max-age=0
[PATH] => /sbin:/usr/sbin:/bin:/usr/bin
[SERVER_SIGNATURE] =>
Apache/2.2.15 (Red Hat) Server at tnxp.telenor.net Port 80
[SERVER_SOFTWARE] => Apache/2.2.15 (Red Hat)
[SERVER_NAME] => tnxp.telenor.net
[SERVER_ADDR] => 10.179.98.20
[SERVER_PORT] => 80
[REMOTE_ADDR] => 148.121.183.28
[DOCUMENT_ROOT] => /var/www/html
[SERVER_ADMIN] => [email protected]
[SCRIPT_FILENAME] => /var/www/html/ew/index.php
[REMOTE_PORT] => 50315
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /ew/
[SCRIPT_NAME] => /ew/index.php
[PHP_SELF] => /ew/index.php
[PHP_AUTH_USER] => t820082
[PHP_AUTH_PW] => asdf
[REQUEST_TIME_FLOAT] => 1359703708.68
[REQUEST_TIME] => 1359703708
)
理想我想這包含[REMOTE_USER] =>客戶用戶名
任何幫助表示讚賞!
瀏覽器無法發送此變量!因爲它的操作系統用戶名不合法發送... – 2013-02-01 07:49:05
Akam Omer:我不確定這是否正確。我可以在IE中使用Active X獲取它,並且它可以在PHP中不在CGI中運行。 –