Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

boolean ldap_mod_add(integer link, string dn, array entry)


The ldap_mod_add function adds attributes to a DN at the attribute level. Compare
this to ldap_add, which adds attributes at the object level.


boolean ldap_mod_del(integer link, string dn, array entry)


Use ldap_mod_del to remove attributes from a DN at the attribute level. Compare this
to ldap_delete, which removes attributes at the object level.


boolean ldap_mod_replace(integer link, string dn, array entry)


The ldap_mod_replace function replaces entries for a DN at the attribute level.
Compare this to ldap_modify, which replaces attributes at the object level.


boolean ldap_modify(integer link, string dn, array entry)


The ldap_modify function modifies an entry. Otherwise, it behaves identically to
ldap_add.


string ldap_next_attribute(integer link, integer entry, integer
pointer)


The ldap_next_attribute function is used to traverse the list of attributes for an
entry. The pointer argument is passed by reference.


<?


//connect to LDAP server
if(!($ldap=ldap_connect("ldap.itd.umich.edu")))
{
die("Could not connect to LDAP server!");
}


// list organizations in the US
$dn = "o=University of Michigan, c=US";
$filter = "objectClass=*";


//perform search
if(!($result = ldap_list($ldap, $dn, $filter)))
{
die("Nothing Found!");
}


// get all attributes for first entry
$entry = ldap_first_entry($ldap, $result);

Free download pdf