11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.it-ebooks.infoCHAPTER 17 • <strong>PHP</strong> AND LDAP$dn = "cn=John Wayne,ou=People,dc=WJGilmore,dc=com ";$attrs["mail"] = "pilgrim@example.com";ldap_mod_delete($connection, $dn, $attrs);Working with the Distinguished NameIt’s sometimes useful to learn more about the DN of the object you’re working with. There are severalfunctions available for doing this very thing.Converting the DN to a Readable FormatThe ldap_dn2ufn() function converts a DN to a more readable format. Its prototype follows:string ldap_dn2ufn(string dn)This is best illustrated with an example:This returns the following:People, staff, ad.example.comLoading the DN into an ArrayThe ldap_explode_dn() function operates much like ldap_dn2ufn(), except that each component of theDN is returned in an array rather than in a string, with the first array element containing the array size.Its prototype follows:array ldap_explode_dn(string dn, int only_values)If the only_values parameter is set to 0, both the attributes and corresponding values are includedin the array elements; if it is set to 1, just the values are returned. Consider this example:

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

Saved successfully!

Ooh no, something went wrong!