Page 1 of 1
PHP and Active Diretory
Posted: Wed Jul 13, 2005 8:53 am
by quadoc
I'm trying to incorporate Active Directory into PHP, has anyone done this before? Please post some tips. Thanks...

Re: PHP and Active Diretory
Posted: Wed Jul 13, 2005 9:02 am
by Roja
quadoc wrote:I'm trying to incorporate Active Directory into PHP, has anyone done this before? Please post some tips. Thanks...

You'll need to be more specific about what you want to accomplish.
Do you want pass through browser login using their domain credentials?
Do you want full access to the AD user information (not just pass/fail auth by username)?
Each are different. Also, which webserver are you using? It does make a difference here, as IIS will give you access to some of the above natively without any work in PHP. Also, is the machine that will host the code a trusted member of the domain? It will need to be for virtually *any* interaction with the AD.
Be more specific, and we can give more specific answers.

Posted: Wed Jul 13, 2005 9:22 am
by quadoc
Sorry, I should made it clearer in the previous post.
And yes, I want want pass through browser login using their domain credentials and full access to the AD user information on IIS
Posted: Wed Jul 13, 2005 12:00 pm
by timvw
Posted: Wed Jul 13, 2005 12:52 pm
by Roja
quadoc wrote:
And yes, I want want pass through browser login using their domain credentials and full access to the AD user information on IIS
Okay, thats two different problems.
The first one (pass thru browser login auth):
Configure the directory in IIS to NOT allow anonymous logins. This will force it to use one of the authenticated user types, and the defaults include IIS/AD authentication.
Then, and I'm not kidding, in your app you just need this:
Code: Select all
$loginstuff = explode("",$_SERVER['AUTH_USER']);
echo "Domain: " . $loginstuff[0];
echo "<br>";
echo "Username: " . $loginstuff[1];
Thats it. (I'm blissfully ignoring security, reg_globals, and other issues in this snippet. Feel free to persue those seperately)
Now, the second problem is worlds different. It involves setting up AD to respond to LDAP requests, building a proper LDAP query string, using the php LDAP functions, and so on.
I suggest looking for a ready made package (library, class) for handling something that epic.
Posted: Thu Jul 14, 2005 8:59 am
by quadoc
Thanks a lot for the info guys...
