Using PHP with the Active Directory - the first to configuring your Joomla to use LDAP |
This tutorial teaches you how to setup a php script to integrate with an Active Directory.
In this. particular active directory, I setup my domain as Testing.local as you can see in the top left hand corner of the above image. I have created two user accounts one called god and the other called gary ZW. Teh. The login id for gary ZW. Teh is garyjob account god is an administrators account account garyjob is a domain user account Below is the chunk of code that does the connection and retrieval of the information from the active directory <?php */
/* */ /* $filter = "(cn=*)"; /* $ad = ldap_connect("ldap://testing") or die("Couldn't connect to AD!");
/* ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
/* $bd = ldap_bind($ad,"garyjob@testing.local","password") or die("Couldn't bind to AD!");
/* $bd = ldap_bind($ad,"god","password") or die("Couldn't bind to AD!"); /* $result = ldap_search($ad, $dn, $filter, $attributes); /* $entries = ldap_get_entries($ad, $result); print_r($entries );
|