Question

I'm working on an intranet web application in PHP. Im trying to use Windows NT login credentials to logon to the application. The trouble im having here is how do i get the remote users windows username? I want to obtain the username and then check against various LDAP groups so that I can direct them to appropriate pages in my application.

I've so far tried

<?php
echo $_SERVER['REMOTE_USER'];
echo $_SERVER['PHP_AUTH_USER'];
?>

Both of them return empty values.

UPDATE: Using $_SERVER['REMOTE_ADDR'] Im able to get the IP address of the computer. Is there anyway I could get userid/username (anything unique) and use it to compare against LDAP groups? I would want to do this, when they enter the main page of the website and store a session and then use the session variable throughout the website.

No correct solution

OTHER TIPS

Not sure if you still need help with this but recently i've had to create code to log intranet users on to our site automatically using windows authentication which is run using IIS. When using windows authentication and ISS in order obtain the logged in user firstly ensure you have windows authentication enabled and anonymous disabled.

$_SERVER['AUTH_USER']; // obtain the LanID of the logged in user.

If you require more info let me know.

You have to send the NTLM-Authenticate headers first. After that, there should be the right user in the $_SERVER-Vars

header('WWW-Authenticate: NTLM');
echo $_SERVER['AUTH_USER'];

AFAIK this only works in InternetExporer - browsers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top