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'){
19 $link = @da_sql_pconnect($config);
21 $res = @da_sql_query($link,$config,
22 "SELECT Attribute,Value $op FROM $config[sql_check_table] WHERE UserName = '$login';");
24 if (@da_sql_num_rows($res,$config))
26 while(($row = @da_sql_fetch_array($res,$config))){
27 $attr = $row[Attribute];
31 $tmp["$attr"][operator][]="$oper";
33 $tmp["$attr"][]="$val";
34 $tmp["$attr"][count]++;
36 $res = @da_sql_query($link,$config,
37 "SELECT Attribute,Value $op FROM $config[sql_reply_table] WHERE UserName = '$login';");
39 if (@da_sql_num_rows($res,$config))
41 while(($row = @da_sql_fetch_array($res,$config))){
42 $attr = $row[Attribute];
46 $tmp["$attr"][operator][]="$oper";
48 $tmp["$attr"][] = "$val";
49 $tmp["$attr"][count]++;
51 if ($config[sql_use_user_info_table] == 'true'){
52 $res = @da_sql_query($link,$config,
53 "SELECT * FROM $config[sql_user_info_table] WHERE UserName = '$login';");
55 if (@da_sql_num_rows($res,$config))
57 if (($row = @da_sql_fetch_array($res,$config))){
58 $cn = ($row[Name]) ? $row[Name] : '-';
59 $telephonenumber = ($row[WorkPhone]) ? $row[WorkPhone] : '-';
60 $homephone = ($row[HomePhone]) ? $row[HomePhone] : '-';
61 $ou = ($row[Department]) ? $row[Department] : '-';
62 $mail = ($row[Mail]) ? $row[Mail] : '-';
63 $mobile = ($row[Mobile]) ? $row[Mobile] : '-';
69 echo "<b>Database query failed partially</b><br>\n";
70 foreach($attrmap as $key => $val){
71 if (isset($tmp[$val])){
72 $item_vals["$key"] = $tmp[$val];
73 $item_vals["$key"][count] = $tmp[$val][count];
75 $item_vals["$key"][operator] = $tmp[$val][operator];
82 echo "<b>Database query failed</b><br>\n";
85 echo "<b>Could not connect to database</b><br>\n";