note 43204 added to function.ldap-bind

From: Date: Mon, 14 Jun 2004 03:32:42 +0000
Subject: note 43204 added to function.ldap-bind
Groups: php.notes 
Request: Send a blank email to php-notes+get-71025@lists.php.net to get a copy of this message
I want to point out that the line that reads "$ldaprdn = 'uname';" is a bit confusing. You need to ensure that you use the entire rootdn. for instance. your code should look more like this... <?php // using ldap bind *** NOTE the uname ***** $ldaprdn = 'cn=root,dc=testserver,dc=com'; // ldap rdn or dn $ldappass = 'secret'; // associated password // connect to ldap server $ldapconn = ldap_connect("ldap.testserver.com") or die("Could not connect to LDAP server."); if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) { echo "Using LDAPv3"; } else { echo "Failed to set protocol version to 3"; } if ($ldapconn) { // binding to ldap server $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { echo "LDAP bind successful..."; } else { echo "LDAP bind failed..."; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.ldap-bind.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43204 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43204&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43204&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71025) next »