2,6 → 2,17 |
//gestion de la langue |
if (is_file("../lib/langues.php")) |
include("../lib/langues.php"); |
|
if(!isset($selected['5'])) $selected['5'] = ''; |
if(!isset($selected['10'])) $selected['10'] = ''; |
if(!isset($selected['15'])) $selected['15'] = ''; |
if(!isset($selected['20'])) $selected['20'] = ''; |
if(!isset($selected['40'])) $selected['40'] = ''; |
if(!isset($selected['80'])) $selected['80'] = ''; |
if(!isset($selected['all'])) $selected['all'] = ''; |
if(!isset($selected['asc'])) $selected['asc'] = ''; |
if(!isset($selected['desc'])) $selected['desc'] = ''; |
|
require('/etc/freeradius-web/config.php'); |
require('../lib/functions.php'); |
require('../lib/sql/functions.php'); |
29,20 → 40,22 |
} |
|
$now = time(); |
$now_str = ($now_str != '') ? "$now_str" : date($config[sql_date_format],$now + 86400); |
$prev_str = ($prev_str != '') ? "$prev_str" : date($config[sql_date_format], $now - 604800 ); |
$now_str = (isset($now_str) && $now_str != '') ? "$now_str" : date($config['sql_date_format'],$now + 86400); |
$prev_str = (isset($prev_str) && $prev_str != '') ? "$prev_str" : date($config['sql_date_format'], $now - 604800 ); |
$num = 0; |
$pagesize = ($pagesize) ? $pagesize : 10; |
$pagesize = (isset($pagesize) && $pagesize) ? $pagesize : 10; |
if (!is_numeric($pagesize) && $pagesize != 'all') |
$pagesize = 10; |
$limit = ($pagesize == 'all') ? '' : "$pagesize"; |
$selected[$pagesize] = 'selected'; |
$order = ($order != '') ? $order : $config[general_accounting_info_order]; |
$order = (isset($order) && $order != '') ? $order : $config['general_accounting_info_order']; |
if ($order != 'desc' && $order != 'asc') |
$order = 'desc'; |
$selected[$order] = 'selected'; |
$now_str = mysql_escape_string($now_str); |
$prev_str = mysql_escape_string($prev_str); |
|
$link = da_sql_pconnect($config); |
$now_str = da_sql_escape_string($link, $now_str); |
$prev_str = da_sql_escape_string($link, $prev_str); |
//$now_str = da_sql_escape_string($now_str); |
//$prev_str = da_sql_escape_string($prev_str); |
|
61,7 → 74,7 |
<body> |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th>$l_users_managment</th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" |
height="2"></td></tr> |
</TABLE> |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1> |
99,53 → 112,55 |
<td><b>#</b></td> |
<?php |
for($i=1;$i<=9;$i++){ |
if (($acct_attrs['ua']["$i"] != '') && ($acct_attrs['ua']["$i"] != 'server') && ($acct_attrs['ua']["$i"] != 'callerid')) |
if (isset($acct_attrs['ua']["$i"]) && ($acct_attrs['ua']["$i"] != '') && ($acct_attrs['ua']["$i"] != 'server') && ($acct_attrs['ua']["$i"] != 'callerid')) |
echo "<td><b>" . $acct_attrs['ua']["$i"] . "</b></td>\n"; |
} |
$sql_extra_query = ''; |
if ($config[sql_accounting_extra_query] != '') |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config); |
if (isset($config['sql_accounting_extra_query']) && $config['sql_accounting_extra_query'] != '') |
$sql_extra_query = xlat($config['sql_accounting_extra_query'],$login,$config); |
?> |
</tr> |
|
<?php |
$link = @da_sql_pconnect($config); |
if ($link){ |
$search = @da_sql_query($link,$config, |
$search = da_sql_query($link,$config, |
"SELECT " . da_sql_limit($limit,0,$config) . " * FROM $config[sql_accounting_table] |
WHERE username = '$login' AND acctstarttime <= '$now_str' |
AND acctstarttime >= '$prev_str' $sql_extra_query " . da_sql_limit($limit,1,$config) . |
" ORDER BY acctstarttime $order " . da_sql_limit($limit,2,$config). " ;"); |
if ($search){ |
while( $row = @da_sql_fetch_array($search,$config) ){ |
$acct_sessiontime_sum = 0; |
$acct_upload_sum = 0; |
$acct_download_sum = 0; |
while( $row = da_sql_fetch_array($search,$config) ){ |
$num++; |
$acct_type = "$row[framedprotocol]/$row[nasporttype]"; |
if ($acct_type == '') |
$acct_type = '-'; |
$acct_logedin = $row[acctstarttime]; |
$acct_sessiontime = $row[acctsessiontime]; |
$acct_logedin = $row['acctstarttime']; |
$acct_sessiontime = $row['acctsessiontime']; |
$acct_sessiontime_sum += $acct_sessiontime; |
$acct_sessiontime = time2str($acct_sessiontime); |
$acct_ip = $row[framedipaddress]; |
$acct_ip = $row['framedipaddress']; |
if ($acct_ip == '') |
$acct_ip = '-'; |
$acct_upload = $row[acctinputoctets]; |
$acct_upload = $row['acctinputoctets']; |
$acct_upload_sum += $acct_upload; |
$acct_upload = bytes2str($acct_upload); |
$acct_download = $row[acctoutputoctets]; |
$acct_download = $row['acctoutputoctets']; |
$acct_download_sum += $acct_download; |
$acct_download = bytes2str($acct_download); |
$acct_server = $row[nasipaddress]; |
$acct_server = $row['nasipaddress']; |
if ($acct_server != ''){ |
$acct_server = $da_name_cache[$row[nasipaddress]]; |
$acct_server = (isset($da_name_cache)) ? $da_name_cache[$row['nasipaddress']] : null; |
if (!isset($acct_server)){ |
$acct_server = @gethostbyaddr($row[nasipaddress]); |
if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){ |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
$acct_server = gethostbyaddr($row['nasipaddress']); |
if (!isset($da_name_cache) && $config['general_use_session'] == 'yes'){ |
$da_name_cache[$row['nasipaddress']] = $acct_server; |
session_register('da_name_cache'); |
} |
else |
$da_name_cache[$row[nasipaddress]] = $acct_server; |
$da_name_cache[$row['nasipaddress']] = $acct_server; |
} |
} |
else |
154,29 → 169,29 |
$acct_terminate_cause = "$row[acctterminatecause]"; |
if ($acct_terminate_cause == '') |
$acct_terminate_cause = '-'; |
if (ereg('Login-Incorrect',$acct_terminate_cause) || |
ereg('Multiple-Logins', $acct_terminate_cause) || ereg('Invalid-User',$acct_terminate_cause)) |
if (preg_match('/Login-Incorrect/',$acct_terminate_cause) || |
preg_match('/Multiple-Logins/', $acct_terminate_cause) || preg_match('/Invalid-User/',$acct_terminate_cause)) |
$acct_callerid = "$row[callingstationid]"; |
if ($acct_callerid == '') |
if (!isset($acct_callerid) || $acct_callerid == '') |
$acct_callerid = '-'; |
echo <<<EOM |
<tr align=center> |
<td>$num</td> |
EOM; |
if ($acct_attrs[ua][1] != '') echo "<td>$acct_type</td>\n"; |
if ($acct_attrs[ua][2] != '') echo "<td>$acct_logedin</td>\n"; |
if ($acct_attrs[ua][3] != '') echo "<td>$acct_sessiontime</td>\n"; |
if ($acct_attrs[ua][4] != '') echo "<td>$acct_ip</td>\n"; |
if ($acct_attrs[ua][5] != '') echo "<td>$acct_upload</td>\n"; |
if ($acct_attrs[ua][6] != '') echo "<td>$acct_download</td>\n"; |
// if ($acct_attrs[ua][7] != '') echo "<td>$acct_server</td>\n"; |
if ($acct_attrs[ua][8] != '') echo "<td>$acct_terminate_cause</td>\n"; |
// if ($acct_attrs[ua][9] != '') echo "<td>$acct_callerid</td>\n"; |
if (isset($acct_attrs['ua'][1]) && $acct_attrs['ua'][1] != '') echo "<td>$acct_type</td>\n"; |
if (isset($acct_attrs['ua'][2]) && $acct_attrs['ua'][2] != '') echo "<td>$acct_logedin</td>\n"; |
if (isset($acct_attrs['ua'][3]) && $acct_attrs['ua'][3] != '') echo "<td>$acct_sessiontime</td>\n"; |
if (isset($acct_attrs['ua'][4]) && $acct_attrs['ua'][4] != '') echo "<td>$acct_ip</td>\n"; |
if (isset($acct_attrs['ua'][5]) && $acct_attrs['ua'][5] != '') echo "<td>$acct_upload</td>\n"; |
if (isset($acct_attrs['ua'][6]) && $acct_attrs['ua'][6] != '') echo "<td>$acct_download</td>\n"; |
// if (isset($acct_attrs['ua'][7]) && $acct_attrs[ua][7] != '') echo "<td>$acct_server</td>\n"; |
if (isset($acct_attrs['ua'][8]) && $acct_attrs['ua'][8] != '') echo "<td>$acct_terminate_cause</td>\n"; |
// if (isset($acct_attrs['ua'][9]) && $acct_attrs[ua][9] != '') echo "<td>$acct_callerid</td>\n"; |
echo "</tr>\n"; |
} |
$acct_sessiontime_sum = time2str($acct_sessiontime_sum); |
$acct_upload_sum = bytes2str($acct_upload_sum); |
$acct_download_sum = bytes2str($acct_download_sum); |
$acct_sessiontime_sum = (isset($acct_sessiontime_sum)) ? time2str($acct_sessiontime_sum) : "0 seconds"; |
$acct_upload_sum = (isset($acct_upload_sum)) ? bytes2str($acct_upload_sum) : "0.00 KBs"; |
$acct_download_sum = (isset($acct_download_sum)) ? bytes2str($acct_download_sum) : "0.00 KBs"; |
} |
else |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n"; |
184,21 → 199,21 |
else |
echo "<b>Could not connect to SQL database</b><br>\n"; |
$colspan = 3; |
if ($acct_attrs[ua][1] == '') |
$colspan--; |
if ($acct_attrs[ua][2] == '') |
$colspan--; |
if (!isset($acct_attrs['ua'][1]) || $acct_attrs['ua'][1] == ''){ |
$colspan--;} |
if (!isset($acct_attrs['ua'][2]) || $acct_attrs['ua'][2] == ''){ |
$colspan--;} |
echo <<<EOM |
<tr bgcolor="lightyellow" align="center"> |
<td colspan=$colspan><b>Total</b></td> |
EOM; |
if ($acct_attrs[ua][3] != '') echo "<td><b>$acct_sessiontime_sum</b></td>\n"; |
if ($acct_attrs[ua][4] != '') echo "<td> </td>\n"; |
if ($acct_attrs[ua][5] != '') echo "<td><b>$acct_upload_sum</b></td>\n"; |
if ($acct_attrs[ua][6] != '') echo "<td><b>$acct_download_sum</b></td>\n"; |
// if ($acct_attrs[ua][7] != '') echo "<td> </td>\n"; |
if ($acct_attrs[ua][8] != '') echo "<td> </td>\n"; |
// if ($acct_attrs[ua][9] != '') echo "<td> </td>\n"; |
if (isset($acct_attrs['ua'][3]) && $acct_attrs['ua'][3] != '') echo "<td><b>$acct_sessiontime_sum</b></td>\n"; |
if (isset($acct_attrs['ua'][4]) && $acct_attrs['ua'][4] != '') echo "<td> </td>\n"; |
if (isset($acct_attrs['ua'][5]) && $acct_attrs['ua'][5] != '') echo "<td><b>$acct_upload_sum</b></td>\n"; |
if (isset($acct_attrs['ua'][6]) && $acct_attrs['ua'][6] != '') echo "<td><b>$acct_download_sum</b></td>\n"; |
// if (isset($acct_attrs['ua'][7]) && $acct_attrs['ua'][7] != '') echo "<td> </td>\n"; |
if (isset($acct_attrs['ua'][8]) && $acct_attrs['ua'][8] != '') echo "<td> </td>\n"; |
// if (isset($acct_attrs['ua'][9]) && $acct_attrs['ua'][9] != '') echo "<td> </td>\n"; |
?> |
</tr> |
</table> |