''. For example, to * delete the 'sn' attribute from an entry, the update array would look like this: * Array ( * sn => '' * ) * * On success, redirect to edit.php * On failure, echo an error. * * @package lists * @subpackage tree * @author David Smith * @author Roland Gruber */ /** security functions */ include_once('../../lib/security.inc'); /** tree functions */ include_once('../../lib/tree.inc'); /** access to configuration */ include_once('../../lib/config.inc'); /** LDAP functions */ include_once('../../lib/ldap.inc'); // start session startSecureSession(); setlanguage(); $dn = $_POST['dn']; $encoded_dn = rawurlencode( $dn ); $update_array = $_POST['update_array']; // check for delete attributes (indicated by the attribute entry appearing like this: attr => '' foreach( $update_array as $attr => $val ) if( ! is_array( $val ) ) if( $val == '' ) { $update_array[ $attr ] = array(); } else { $update_array[ $attr ] = $val; } else { foreach( $val as $i => $v ) { $update_array[ $attr ][ $i ] = $v; } } $ds = $_SESSION['ldap']->server; $res = @ldap_modify( $ds, $dn, $update_array ); if( $res ) { $redirect_url = "edit.php?dn=$encoded_dn"; foreach( $update_array as $attr => $junk ) $redirect_url .= "&modified_attrs[]=$attr"; header( "Location: $redirect_url" ); } else { echo $_SESSION['header']; echo "LDAP Account Manager\n"; echo "\n"; echo "\n"; echo ""; StatusMessage('ERROR', _("Was unable to modify attribtues from DN: %s."), ldap_error( $ds ), array($dn)); echo ""; } ?>