如何使用 PHP/IIS 读取 Windows 登录用户名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3899643/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to read Windows logged in username with PHP/IIS
提问by Alireza
I am running a network. Here I have a domain controller (DC) I just installed IIS6 , PHP and Mysql on it. every thing is working fine.:)
我正在运行一个网络。这里我有一个域控制器(DC),我刚刚在上面安装了 IIS6、PHP 和 Mysql。一切正常。:)
Now I want to bring up a script on this local website. The first problem is that I want to detect which one of network users (active directory users) are logged in with PHP. I mean it is enough for me when the user is logged in to windows there is no need for another authentication.
现在我想在这个本地网站上调出一个脚本。第一个问题是我想检测哪个网络用户(活动目录用户)是用PHP登录的。我的意思是当用户登录到 Windows 时不需要其他身份验证对我来说就足够了。
I was wondering if I could just use a function or something... that its output is the AD username and user group.
我想知道我是否可以只使用一个函数或其他东西……它的输出是 AD 用户名和用户组。
回答by djn
If you've set IIS to authenticate users one or more of these should contain the username:
如果您已将 IIS 设置为对用户进行身份验证,其中一项或多项应包含用户名:
$_SERVER['LOGON_USER']
$_SERVER['AUTH_USER']
$_SERVER['REDIRECT_LOGON_USER']
$_SERVER['REDIRECT_AUTH_USER']