问题描述
用户将只使用 IE,并且在 IE 中,如果他们登录到域控制器,它可以在不提示的情况下传递他们的凭据.
The users will only use IE, and within IE it can pass their credentials without being prompted to, if they are logged onto the domain controller.
我想知道的是,我该如何获取他们的用户名?
What I want to know is, how do I go about grabbing their username?
我认为这可以解决问题:$_SERVER['auth_user'];
但没有运气.
I thought this would do the trick: $_SERVER['auth_user'];
but no luck.
就像这样 你能不能得到一个 Windows (AD)PHP 中的用户名?
但我不知道捕获/获取用户用户名的代码应该是什么样子
But I don't know what the code should look like this to capture/grab the user's username
感谢任何帮助.
推荐答案
没有办法直接用php解决问题,但是可以借助javascript获取用户名:
There is no way to solve the problem in php directly, but you can obtain the username with the help of javascript:
<script type="text/javascript">
<!--
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName);
//-->
</script>
只需添加一些 AJAX ;)
Just add some AJAX ;)
HTH
这篇关于从 IE 中获取用户名,以针对 LDAP 进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!