note 11809 modified in ref.ldap by felipe

From: Date: Tue, 22 Jul 2008 18:57:27 +0000
Subject: note 11809 modified in ref.ldap by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142532@lists.php.net to get a copy of this message
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. --was-- 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: $res = ldap_bind($ldap, $dn, $password); So a full example would be: 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. http://php.net/manual/en/ref.ldap.php

« previous php.notes (#142532) next »