我徒劳地试图让变量$_SERVER['Remote_User']
来验证我的内部应用程序的用户。
有什么办法可以通过作为 CGI 运行的 PHP 来做到这一点?
我已经尝试了在谷歌搜索时发现的所有解决方法(在 .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] => root@localhost
[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] =>客户用户名
任何帮助表示赞赏!