2 require_once('../lib/functions.php3');
3 if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
4 include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
6 echo "<b>Could not include SQL library</b><br>\n";
9 if ($config[sql_use_operators] == 'true'){
10 include("../lib/operators.php3");
16 $link = @da_sql_pconnect($config);
18 $Members = preg_split("/[\n\s]+/",$members,-1,PREG_SPLIT_NO_EMPTY);
19 if (!empty($Members)){
20 foreach ($Members as $member){
21 $member = da_sql_escape_string($member);
22 $res = @da_sql_query($link,$config,
23 "INSERT INTO $config[sql_usergroup_table] (username,groupname)
24 VALUES ('$member','$login');");
25 if (!$res || !@da_sql_affected_rows($link,$res,$config)){
26 echo "<b>Unable to add user $member in group $login: " . da_sql_error($link,$config) . "</b><br>\n";
32 echo "<b>Members list is empty!!</b><br>\n";
34 foreach($show_attrs as $key => $attr){
35 if ($attrmap["$key"] == 'none')
37 if ($attrmap["$key"] == ''){
38 $attrmap["$key"] = $key;
39 $attr_type["$key"] = 'replyItem';
40 $rev_attrmap["$key"] = $key;
42 if ($attr_type["$key"] == 'checkItem'){
43 $table = "$config[sql_groupcheck_table]";
46 else if ($attr_type["$key"] == 'replyItem'){
47 $table = "$config[sql_groupreply_table]";
50 $val = $$attrmap["$key"];
51 $val = da_sql_escape_string($val);
52 $op_name = $attrmap["$key"] . '_op';
55 $op_val = da_sql_escape_string($op_val);
56 if (check_operator($op_val,$type) == -1){
57 echo "<b>Invalid operator ($op_val) for attribute $key</b><br>\n";
60 $op_val2 = ",'$op_val'";
62 if ($val == '' || check_defaults($val,$op_val,$default_vals["$key"]))
64 $res = @da_sql_query($link,$config,
65 "INSERT INTO $table (attribute,value,groupname $text)
66 VALUES ('$attrmap[$key]','$val','$login' $op_val2);");
67 if (!$res || !@da_sql_affected_rows($link,$res,$config))
68 echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
70 echo "<b>Group created successfully</b><br>\n";
74 echo "<b>Could not connect to SQL database</b><br>\n";