PHP operates in Windows Active Directory through the LDAP protocol

Source: Internet
Author: User

Original address: Http://hi.baidu.com/lllangxx/item/3ccb7cdfa13b56eb3dc2cb39

First, learn how to manage active Directory

Active Directory Progressive Series Guide

Second, Adexplorer

To download a adexplorer online, which is an Active Directory browser, allows us to more clearly understand how and how data is stored in Active Directory.

Third, domain access to active Directory

Ensure that the DNS parser for the domain-based computer is configured to use the same DNS name server as Active Directory, and in most cases, assuming that you are using Active Directory-integrated DNS, we set this domain-foreign computer's DNS setting to this Activ E directory server IP address.

For more information, please refer to "Performing Linux client authentication using Active Directory"

Iv. PHP Code

For ease of use, I use ADLDAP for programming, which can be a lot easier.

<?PHPrequire_once(dirname(__file__) . '/adldap.php '); $options=Array();Try {    $options[' Account_suffix ']= "@mydomain. com"; $options[' Base_dn ']= "ou=accounts,dc=mydomain,dc=com";//    $options[' Domain_controllers ']=Array("mydomain.com"); $options[' Ad_username ']= "Administrator"; $options[' Ad_password ']= "123456"; $ldap=NewADLDAP ($options);}Catch(adldapexception$e) {    Echo $e;Exit(); }//Var_dump ($LDAP); Echo("<pre>\n");$result=$ldap->authenticate ("Qiujiayu", "Qiujiayu");Var_dump($result);Echo("----------------------------------------------------");$result=$ldap->folder_list (Array(' Marketing '), Adldap_folder,true, ' Contact ');Var_dump($result); Echo("----------------------------------------------------"); $result=$ldap-all_users ();Var_dump($result); Echo("----------------------------------------------------"); $result=$ldap-all_contacts ();Var_dump($result); Echo(Json_encode ($ldap->contact_info ($result[0],Array(' telephonenumber ')))));Echo("----------------------------------------------------");?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.