?php $ds=ldap_connect( "localhost"); / / assuming the LDAP server is on this host if ($ds) {/ / bind if(ldap_bind($ds)) {/ / prepare data $dn = "cn=Matti Meikku, ou=My Unit, o=My Company, c=FI"; $value = "secretpassword"; $attr = "password"; / / compare value $r=ldap_compare($ds, $dn, $attr, $value); if ($r === -1) {echo "Error: ".ldap_error($ds);} elseif ($r === TRUE) {echo "Password correct .";} elseif ($r === FALSE) {echo "Wrong guess!
?php $ds=ldap_connect( "localhost"); / / doit ecirc;tre un serveur LDAP valide! if ($ds) {/ / identification if(ldap_bind($ds)) {/ / preparation des donn eacute;es $dn = "cn=Matti Meikku, ou=Mon Service, o=Ma Compagnie, c=FR"; $value = "secretpassword"; $attr = "password"; / / comparaison des valeurs $r=ldap_compare($ds, $dn, $attr, $value); if ($r === -1) {echo "Erreur: ".ldap_error($ds);} elseif ($r === TRUE) {echo "Mot de passe correct .";} elseif ($r === FALSE) {echo "Mal choisi!