Brad
Brad

Reputation: 12262

Grab username from IE, to authenticate against LDAP

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?

I thought this would do the trick: $_SERVER['auth_user'];but no luck.

Just like this Can you get a Windows (AD) username in PHP?

But I don't know what the code should look like this to capture/grab the user's username

Any help is appreciated.

Upvotes: 2

Views: 4738

Answers (3)

lod3n
lod3n

Reputation: 2903

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

You can do it in Apache with mod_auth http://rc.quest.com/topics/mod_auth_vas/

Upvotes: 0

tuergeist
tuergeist

Reputation: 9391

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> 

Just add some AJAX ;)

HTH

Upvotes: 2

Allain Lalonde
Allain Lalonde

Reputation: 93348

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

Upvotes: 0

Related Questions