note 11809 deleted from ref.ldap by cmb
| From: | cmb@php.net | Date: | Sun, 17 Nov 2019 08:35:50 +0000 |
| Subject: | note 11809 deleted from ref.ldap by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213077@lists.php.net to get a copy of this message | ||
Note Submitter: mleaver at scis dot ecu dot edu dot au
----
When authenticating to a Win2k LDAP server you must include the name of the person authenticating to
the server in the dn
i.e. cn=administrator, cn=users, dc=server, dc=domain, dc=country
Then when you bind to the LDAP database you use:
<?php $res = ldap_bind($ldap, $dn, $password); ?>
So a full example would be:
<?php
if (!($ldap = ldap_connect("<server>", <port>))) {
die ("Could not connect to LDAP server");
}
$dn = "cn=administrator, cn=users, dc=myserver, dc=com, dc=au";
$password = "MyPassword";
if (!($res = @ldap_bind($ldap, $dn, $password))) {
die ("Could not bind to $dn");
}
?>
Then you do your list or search functions on the ldap database.