Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ldap_error(3) [php man page]

LDAP_ERROR(3)								 1							     LDAP_ERROR(3)

ldap_error - Return the LDAP error message of the last LDAP command

SYNOPSIS
string ldap_error (resource $link_identifier) DESCRIPTION
Returns the string error message explaining the error generated by the last LDAP command for the given $link_identifier. While LDAP errno numbers are standardized, different libraries return different or even localized textual error messages. Never check for a specific error message text, but always use an error number to check. Unless you lower your warning level in your php.ini sufficiently or prefix your LDAP commands with @ (at) characters to suppress warning output, the errors generated will also show up in your HTML output. PARAMETERS
o $link_identifier - An LDAP link identifier, returned by ldap_connect(3). RETURN VALUES
Returns string error message. SEE ALSO
ldap_err2str(3), ldap_errno(3). PHP Documentation Group LDAP_ERROR(3)

Check Out this Related Man Page

LDAP_COMPARE(3) 							 1							   LDAP_COMPARE(3)

ldap_compare - Compare value of attribute found in entry specified with DN

SYNOPSIS
mixed ldap_compare (resource $link_identifier, string $dn, string $attribute, string $value) DESCRIPTION
Compare $value of $attribute with value of same attribute in an LDAP directory entry. PARAMETERS
o $link_identifier - An LDAP link identifier, returned by ldap_connect(3). o $dn - The distinguished name of an LDAP entity. o $attribute - The attribute name. o $value - The compared value. RETURN VALUES
Returns TRUE if $value matches otherwise returns FALSE. Returns -1 on error. EXAMPLES
The following example demonstrates how to check whether or not given password matches the one defined in DN specified entry. Example #1 Complete example of password check <?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! Password incorrect."; } } else { echo "Unable to bind to LDAP server."; } ldap_close($ds); } else { echo "Unable to connect to LDAP server."; } ?> NOTES
Warning ldap_compare(3) can NOT be used to compare BINARY values! PHP Documentation Group LDAP_COMPARE(3)
Man Page