2 require('../lib/sql/attrmap.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'){
23 $homeaddress_lang = '-';
30 $telephonenumber = '-';
35 $user_password_exists = 'no';
39 $link = @da_sql_pconnect($config);
41 $res = @da_sql_query($link,$config,
42 "SELECT attribute,value $op FROM $config[sql_check_table] WHERE username = '$login';");
44 if (@da_sql_num_rows($res,$config))
46 while(($row = @da_sql_fetch_array($res,$config))){
47 $attr = $row[attribute];
49 if ($attr == $config[sql_password_attribute] && $val != '')
50 $user_password_exists = 'yes';
53 $tmp["$attr"][operator][]="$oper";
55 $tmp["$attr"][]="$val";
56 $tmp["$attr"][count]++;
58 $res = @da_sql_query($link,$config,
59 "SELECT attribute,value $op FROM $config[sql_reply_table] WHERE username = '$login';");
61 if (@da_sql_num_rows($res,$config))
63 while(($row = @da_sql_fetch_array($res,$config))){
64 $attr = $row[attribute];
68 $tmp["$attr"][operator][]="$oper";
70 $tmp["$attr"][] = "$val";
71 $tmp["$attr"][count]++;
73 if ($config[sql_use_user_info_table] == 'true'){
74 $res = @da_sql_query($link,$config,
75 "SELECT * FROM $config[sql_user_info_table] WHERE username = '$login';");
77 if (@da_sql_num_rows($res,$config)){
81 if (($row = @da_sql_fetch_array($res,$config))){
82 $cn = ($row[name] != '') ? $row[name] : '-';
83 $telephonenumber = ($row[workphone] != '') ? $row[workphone] : '-';
84 $homephone = ($row[homephone] != '') ? $row[homephone] : '-';
85 $ou = ($row[department] != '') ? $row[department] : '-';
86 $mail = ($row[mail] != '') ? $row[mail] : '-';
87 $mobile = ($row[mobile] != '') ? $row[mobile] : '-';
91 echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n";
95 echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n";
97 foreach(array_keys($tmp) as $val){
100 $key = $rev_attrmap["$val"];
103 $attrmap["$key"] = $val;
104 $attr_type["$key"] = 'replyItem';
105 $rev_attrmap["$val"] = $key;
107 $item_vals["$key"] = $tmp[$val];
108 $item_vals["$key"][count] = $tmp[$val][count];
110 $item_vals["$key"][operator] = $tmp[$val][operator];
116 echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
119 echo "<b>Could not connect to SQL database</b><br>\n";