Take username from IE to authenticate with LDAP

Users will only use IE and inside IE can pass their credentials without prompting if they are logged into a domain controller.

What I want to know, so how can I get my username?

I thought this would do the trick: $_SERVER['auth_user'];

but no luck.

Just how Can you get the Windows username (AD) in PHP?

But I dont know how the code to capture / grab the username should look like

Any help is appreciated.

+2


source to share


3 answers


There is no way to solve the problem in php directly, but you can get the username using javascript:

<script type="text/javascript">
<!--
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName);
//-->
</script> 

      



Just add AJAX;)

NTN

+1


source


If your PHP is running on IIS, you can block it at this level. I'm not sure if you can access the username, but at least it will only be available to authenticated users with proper site access permissions. Hope this was a little helpful.



0


source


You must enable Integrated Authentication on the application folder in IIS, then your method will work.

You can do this in Apache using mod_auth http://rc.quest.com/topics/mod_auth_vas/

0


source







All Articles