$val ) { if( $val == '' ) { echo $_SESSION['header']; echo "LDAP Account Manager\n"; echo "\n"; echo "\n"; StatusMessage("ERROR", _('You left the value blank for required attribute: %s.'), '', array(htmlspecialchars($attr))); echo ""; exit; } $new_entry[ $attr ][] = $val; } } if( isset( $attrs ) && is_array( $attrs ) ) { foreach( $attrs as $i => $attr ) { if( is_attr_binary( $attr ) ) { if( isset( $_FILES['vals']['name'][$i] ) && $_FILES['vals']['name'][$i] != '' ) { // read in the data from the file $file = $_FILES['vals']['tmp_name'][$i]; $f = fopen( $file, 'r' ); $binary_data = fread( $f, filesize( $file ) ); fclose( $f ); $val = $binary_data; $new_entry[ $attr ][] = $val; } } else { $val = isset( $vals[$i] ) ? $vals[$i] : ''; if( '' !== trim($val) ) $new_entry[ $attr ][] = $val; } } } $new_entry['objectClass'] = $object_classes; if( ! in_array( 'top', $new_entry['objectClass'] ) ) $new_entry['objectClass'][] = 'top'; foreach( $new_entry as $attr => $vals ) { if( ! is_attr_binary( $attr ) ) if( is_array( $vals ) ) { foreach( $vals as $i => $v ) { $new_entry[ $attr ][ $i ] = $v; } } else { $new_entry[ $attr ] = $vals; } } //echo "
"; var_dump( $new_dn );print_r( $new_entry ); echo "
"; $ds = $_SESSION['ldap']->server; // Check the user-defined custom call back first $add_result = @ldap_add( $ds, $new_dn, $new_entry ); if( $add_result ) { $redirect_url = "edit.php?dn=" . rawurlencode( $new_dn ); if( array_key_exists( 'tree', $_SESSION ) ) { $tree = $_SESSION['tree']; $tree_icons = $_SESSION['tree_icons']; if( isset( $tree[$container] ) ) { $tree[$container][] = $new_dn; sort( $tree[$container] ); $tree_icons[$new_dn] = get_icon( $new_dn ); } $_SESSION['tree'] = $tree; $_SESSION['tree_icons'] = $tree_icons; session_write_close(); } ?> \n"; echo "\n"; echo "\n"; echo "\n"; echo ""; // print link if refresh does not work echo "

\n"; echo "" . _("Click here if you are not directed to the next page.") . "\n"; echo "

\n"; echo "\n"; echo "\n"; } ?> LDAP Account Manager\n"; echo "\n"; echo "\n"; StatusMessage("ERROR", _("LAM was unable to create account %s! An LDAP error occured."), ldap_error($ds), array($new_dn)); echo "\n"; } ?>