Authenticating in PHP using LDAP through Active Directory?

Importing a whole library seems inefficient when all you need is essentially two lines of code $ldap = ldap_connect("ldap.example. Com") if($bind = ldap_bind($ldap, $_POST'username', $_POST'password')) { // log them in! } else { // error message }.

Importing a whole library seems inefficient when all you need is essentially two lines of code... $ldap = ldap_connect("ldap.example. Com") if($bind = ldap_bind($ldap, $_POST'username', $_POST'password')) { // log them in! } else { // error message }.

Thanks for a concrete example! – DV. Oct 5 '08 at 18:56 Thanks for this simple and straight forward example.It just saved my day :) – Techpriester Jan 29 '10 at 10:20 1 Some installations of AD will bind successfully if the password provided is empty.

Watch out for this! You may need to ensure a non-empty password before trying to authenticate. – Yotaware Oct 20 at 16:32.

I do this simply by passing the user credentials to ldap_bind(). php.net/manual/en/function.ldap-bind.php If the account can bind to LDAP, it's valid; if it can't, it's not. If all you're doing is authentication (not account management), I don't see the need for a library.

I like the Zend_Ldap Class, you can use only this class in your project, without the Zend Framework.

PHP has libraries: ca.php.net/ldap PEAR also has a number of packages: pear.php.net/search.php?q=ldap&in=packag... I haven't used either, but I was going to at one point and they seemed like they should work.

This is simple and works! $ldap = ldap_connect("ldap.example. Com"); if($bind = ldap_bind($ldap, $_POST'username', $_POST'password')) { // log them in!

} else { // error message } Is there a way to return the username used to bind? I've tried a few things and I get no value. Would like the username becuase the intranet has secure and unsecure sections that are based on user.

Just small query. To be able to authenticate users like this , should the script be running inside network i. E with AD?

– JPro Mar 4 '10 at 10:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions