This code sample shows how to delte objects or attributes of existing objects from eDirectory in PHP using LDAP.
<?php
$server='localhost';
$admin='cn=admin,o=novell';
$passwd='novell';
$ds=ldap_connect($server); // assuming the LDAP server is on this host
if ($ds) {
// bind with appropriate dn to give update access
$r=ldap_bind($ds, $admin, $passwd);
if(!$r) die("ldap_bind failed<br>");
// delete an entry
$r=ldap_delete($ds, "cn=pjones,ou=users,o=novell");
if(!$r) die("ldap_delete failure<br>");
ldap_close($ds);
echo "ldap_delete success";
} else {
echo "Unable to connect to LDAP server";
}
?>
© 2008 Novell, Inc. All Rights Reserved.