コード例 #1
0
function connect2db($config)
{
    $link = @da_sql_pconnect($config);
    return $link;
}
コード例 #2
0
    $days[$i] = date($config[sql_date_format], $now_tmp);
    $now_tmp -= 86400;
}
$day++;
//$now -= ($day * 86400);
$now -= 604800;
$now += 86400;
for ($i = $day; $i <= 6; $i++) {
    $days[$i] = date($config[sql_date_format], $now);
    //	$now -= 86400;
    $now += 86400;
}
$daily_used = $weekly_used = $monthly_used = $lastlog_session_time = '-';
$extra_msg = '';
$used = array('-', '-', '-', '-', '-', '-', '-');
$link = @da_sql_pconnect($config);
if ($link) {
    $search = @da_sql_query($link, $config, "SELECT sum(acctsessiontime) AS sum_sess_time,\n\tsum(acctinputoctets) AS sum_in_octets,\n\tsum(acctoutputoctets) AS sum_out_octets,\n\tavg(acctsessiontime) AS avg_sess_time,\n\tavg(acctinputoctets) AS avg_in_octets,\n\tavg(acctoutputoctets) AS avg_out_octets,\n\tCOUNT(*) as counter FROM\n\t{$config['sql_accounting_table']} WHERE username = '{$login}'\n\tAND acctstarttime >= '{$week_str}' AND acctstarttime <= '{$now_str}';");
    if ($search) {
        $row = @da_sql_fetch_array($search, $config);
        $tot_time = time2str($row[sum_sess_time]);
        $tot_input = bytes2str($row[sum_in_octets]);
        $tot_output = bytes2str($row[sum_out_octets]);
        $avg_time = time2str($row[avg_sess_time]);
        $avg_input = bytes2str($row[avg_in_octets]);
        $avg_output = bytes2str($row[avg_out_octets]);
        $tot_conns = $row[counter];
    } else {
        echo "<b>Database query failed: " . da_sql_error($link, $config) . "</b><br>\n";
    }
    $search = @da_sql_query($link, $config, "SELECT sum(acctsessiontime) AS sum_sess_time FROM {$config['sql_accounting_table']} WHERE username = '{$login}'\n\tAND acctstarttime >= '{$week_start}' AND acctstarttime <= '{$now_str}';");
コード例 #3
0
<meta http-equiv="Content-Type" content="text/html; charset={$config['general_charset']}">
<link rel="stylesheet" href="style.css">
</head>
<body>
<center>
<b>Could not include SQL library functions. Aborting</b>
</body>
</html>
EOM;
    exit;
}
$operators = array('=', '<', '>', '<=', '>=', '!=', 'regexp', 'like', 'not like');
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);
unset($items);
for ($i = 0; $i < $no_fields; $i++) {
    $key = strtolower(@da_sql_field_name($fields, $i, $config));
    $val = $sql_attrs[$key][desc];
    if ($val == '') {
        continue;
    }
    $show = $sql_attrs[$key][show];
    $selected[$key] = $show == 'yes' ? 'selected' : '';
    $items[$key] = "{$val}";
}
asort($items);
class Qi