28,15 → 28,15 |
if ($config['sql_type'] == 'pg'){ |
$operators=array( '=','<', '>', '<=', '>=', '~', 'like', '~*', '~~*', '<<=' ); |
} |
|
$link = da_sql_pconnect ($config) or die('cannot connect to sql databse'); |
$fields = da_sql_list_fields($config[sql_accounting_table],$link,$config); |
$no_fields = da_sql_num_fields($fields,$config); |
$fields = da_sql_list_fields($config['sql_accounting_table'],$link,$config); |
|
|
unset($items); |
|
for($i=0;$i<$no_fields;$i++){ |
$key = strtolower(da_sql_field_name($fields,$i,$config)); |
while($row = $fields->fetch_array()) |
{ |
$key = strtolower($row[0]); |
$val = $sql_attrs[$key]['desc']; |
if ($val == '') |
continue; |
120,6 → 120,10 |
<TABLE width="100%" border="1" cellspacing="0" cellpadding="1"> |
<tr><td> |
<?php |
if(!isset($queryflag)) |
{ |
$queryflag = 0; |
} |
if(!$queryflag) { |
echo <<<EOM |
<form method=post> |
178,7 → 182,7 |
|
$number=1; |
$offset=0; |
while (${"item_of_w$number"}) { |
while (isset(${"item_of_w$number"}) && ${"item_of_w$number"}) { |
if(${"delete_w$number"}==1) {$offset=1;$number++;} |
else { |
$designator=$number-$offset; |
188,7 → 192,7 |
$number++; |
} |
} |
if($add==1) { |
if(isset($add) && $add==1) { |
${"w$number"} = new Qi("w$number","$item_name","$operators[0]"); |
${"w$number"}->show(); |
} |
211,8 → 215,10 |
} |
|
if ($queryflag == 1){ |
if(!isset($where)) |
$where = ""; |
$i = 1; |
while (${"item_of_w$i"}){ |
while (isset(${"item_of_w$i"}) && ${"item_of_w$i"}){ |
$op_found = 0; |
foreach ($operators as $operator){ |
if (${"operator_of_w$i"} == $operator){ |
223,7 → 229,7 |
if (!$op_found) |
die("L'opération demandé n'est pas valide. Sortie anormale."); |
${"item_of_w$i"} = preg_replace('/\s/','',${"item_of_w$i"}); |
${"value_of_w$i"} = da_sql_escape_string(${"value_of_w$i"}); |
${"value_of_w$i"} = da_sql_escape_string($link,${"value_of_w$i"}); |
$where .= ($i == 1) ? ' WHERE ' . ${"item_of_w$i"} . ' ' . ${"operator_of_w$i"} . " '" . ${"value_of_w$i"} . "'" : |
' AND ' . ${"item_of_w$i"} . ' ' . ${"operator_of_w$i"} . " '" . ${"value_of_w$i"} . "'" ; |
$i++; |
237,14 → 243,25 |
if (!is_numeric($maxresults)) |
die("Max Results is not in numeric form. Exiting abnormally."); |
|
unset($query_view); |
$query_view = ''; |
foreach ($accounting_show_attrs as $val) |
$query_view .= $val . ','; |
$query_view = ereg_replace(',$','',$query_view); |
unset($sql_extra_query); |
if ($config[sql_accounting_extra_query] != '') |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
$sql_extra_query = da_sql_escape_string($sql_extra_query); |
if (isset($config['sql_accounting_extra_query'])){ |
$sql_extra_query = xlat($config['sql_accounting_extra_query'],$login,$config); |
$sql_extra_query = da_sql_escape_string($link,$sql_extra_query); |
} |
else |
{ |
$sql_extra_query = ""; |
} |
|
if(!isset($where)) |
{ |
$where = ""; |
} |
|
$query="SELECT " . da_sql_limit($maxresults,0,$config) . " $query_view FROM $config[sql_accounting_table] |
$where $sql_extra_query " . da_sql_limit($maxresults,1,$config) . |
" ORDER BY $order DESC " . da_sql_limit($maxresults,2,$config) . ";"; |
257,8 → 274,14 |
<tr bgcolor="#d0ddb0"> |
</tr> |
EOM; |
|
|
foreach($accounting_show_attrs as $val){ |
$desc = $sql_attrs[$val][desc]; |
$desc = $sql_attrs[$val]['desc']; |
if($val == 'acctoutputoctets') |
$desc = "Upload"; |
if($val == 'acctinputoctets') |
$desc = "Download"; |
echo "<th>$desc</th>\n"; |
} |
echo "</tr>\n"; |
266,13 → 289,16 |
$search = da_sql_query($link,$config,$query); |
if ($search){ |
while( $row = da_sql_fetch_array($search,$config) ){ |
$num++; |
//$num++; |
echo "<tr align=center>\n"; |
foreach($accounting_show_attrs as $val){ |
$info = $row[$val]; |
if($val == "acctoutputoctets" || $val == "acctinputoctets") |
$info = bytes2str($info); |
if($val == "acctsessiontime") |
$info = time2strclock($info); |
if ($info == '') |
$info = '-'; |
$info = $sql_attrs[$val][func]($info); |
if ($val == 'username'){ |
$Info = urlencode($info); |
$info = "<a href=\"user_admin.php?login=$Info\" title=\"Edit user $info\">$info<a/>"; |