14.02.2014 Views

ldapv3.pdf 7947KB Apr 17 2013 11:30:42 AM - mirror omadata

ldapv3.pdf 7947KB Apr 17 2013 11:30:42 AM - mirror omadata

ldapv3.pdf 7947KB Apr 17 2013 11:30:42 AM - mirror omadata

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ldap_compare<br />

Since LDAP permits the value of an attribute to be made available for<br />

comparison, while not actually bieng able to be read, PHP provides the boolean<br />

ldap_compare(resource link_identifier, string dn, string attribute, string value) function.<br />

ldap_compare returns TRUE if the value specified attribute of the given dn<br />

matches that of the passed value.<br />

For simple checks against the directory this is also significantly less code to<br />

perform a comparison than the ldap_search, ldap_get_entries, ldap_free_result<br />

trio.<br />

$r = ldap_compare($ds, "cn=Adam Williams,ou=People,dc=Whitemice,dc=Org", "morrisonvpnaccess", "Y");<br />

if ($r = -1)<br />

echo "Error: " . ldap_error($ds);<br />

ldap_compare returns:<br />

else<br />

TRUE on a successful comparison<br />

if ($r)<br />

FALSE on a non-true comparison<br />

echo "VPN Access Granted";<br />

(-1) if an error occurred.<br />

else<br />

ldap_compare cannot be used on binary values.<br />

echo "VPN Access Denied";

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!