} else {
                if ($attr_type["{$key}"] == 'replyItem') {
                    $table = "{$config['sql_groupreply_table']}";
                    $type = 2;
                }
            }
            $val = ${$attrmap}["{$key}"];
            $val = da_sql_escape_string($val);
            $op_name = $attrmap["{$key}"] . '_op';
            $op_val = ${$op_name};
            if ($op_val != '') {
                $op_val = da_sql_escape_string($op_val);
                if (check_operator($op_val, $type) == -1) {
                    echo "<b>Invalid operator ({$op_val}) for attribute {$key}</b><br>\n";
                    coninue;
                }
                $op_val2 = ",'{$op_val}'";
            }
            if ($val == '' || check_defaults($val, $op_val, $default_vals["{$key}"])) {
                continue;
            }
            $res = @da_sql_query($link, $config, "INSERT INTO {$table} (attribute,value,groupname {$text})\n\t\t\tVALUES ('{$attrmap[$key]}','{$val}','{$login}' {$op_val2});");
            if (!$res || !@da_sql_affected_rows($link, $res, $config)) {
                echo "<b>Query failed for attribute {$key}: " . da_sql_error($link, $config) . "</b><br>\n";
            }
        }
        echo "<b>Group created successfully</b><br>\n";
    }
} else {
    echo "<b>Could not connect to SQL database</b><br>\n";
}
         //	the value is the same as that in ldap then continue
         //
         if (check_defaults($val, '', $default_vals["{$key}"]) && !isset($item_vals["{$key}"][$j]) || $val == $item_vals["{$key}"][$j]) {
             continue;
         }
         //
         //	if value is null and ldap attribute does not exist then continue
         //
         if ($val == '' && !isset($item_vals["{$key}"][$j])) {
             continue;
         }
         //
         //	if values is the same as the default or if the value is null and the ldap attribute exists
         //	then delete them
         //
         if ((check_defaults($val, '', $default_vals["{$key}"]) || $val == '') && isset($item_vals["{$key}"][$j])) {
             $del[$attrmap["{$key}"]][] = $item_vals["{$key}"][$j];
         } else {
             if (isset($item_vals["{$key}"][$j])) {
                 $del[$attrmap["{$key}"]][] = $item_vals["{$key}"][$j];
                 $add_r[$attrmap["{$key}"]][] = $val;
             } else {
                 $add_r[$attrmap["{$key}"]][] = $val;
             }
         }
     }
 }
 if (isset($del)) {
     if ($config[ldap_debug] == 'true') {
         print "<b>DEBUG(LDAP): ldap_mod_del(): DN='{$dn}'</b><br>\n";
         print "<b>DEBUG(LDAP): ldap_mod_del(): Data:";
 if ($config[ldap_debug] == 'true') {
     print "<b>DEBUG(LDAP): ldap_add(): DN='{$dn}'</b><br>\n";
     print "<b>DEBUG(LDAP): ldap_add(): Entry Data:";
     print_r($new_user_entry);
     print "</b><br>\n";
 }
 @ldap_add($ds, $dn, $new_user_entry);
 foreach ($show_attrs as $key => $attr) {
     if ($attrmap["{$key}"] == 'none') {
         continue;
     }
     //
     //	if value is the same as the default and the corresponding attribute in ldap does not exist or
     //	the value is the same as that in ldap then continue
     //
     if (check_defaults(${$attrmap}["{$key}"], '', $default_vals["{$key}"])) {
         continue;
     }
     if (${$attrmap}["{$key}"] == '') {
         continue;
     }
     unset($mod);
     $mod[$attrmap["{$key}"]] = ${$attrmap}["{$key}"];
     if ($config[ldap_debug] == 'true') {
         print "<b>DEBUG(LDAP): ldap_mod_add(): DN='{$dn}'</b><br>\n";
         print "<b>DEBUG(LDAP): ldap_mod_add(): Data:";
         print_r($mod);
         print "</b><br>\n";
     }
     @ldap_mod_add($ds, $dn, $mod);
 }