User login Portal
Tudor
tudor at cotswoldpc.co.uk
Wed Apr 29 16:44:17 CEST 2009
still blank heres what i have done so far
still need big help
much appreciated
<?php
error_reporting(E_ALL);
$unitsBytesBin = array('B','KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB');
function bcHighPow($val, $precision = 2, $expLimit = 10, $base = 1024){
$i = 0; $pDiv = 1; $val = (string) $val; $base = (string) $base;
while (true) {
$i++;
$div = bcpow($base, (string) $i);
if((bccomp($val, $div) === -1) || ($i >= $expLimit)){
$out = bcdiv($val,$pDiv,$precision);
break;
}else
$pDiv = $div;
}
return array((float) $out,$unitBytesBin[$i]);
}
$db = mysql_connect('localhost','root','*******',true);
mysql_select_db('radius',$db);
$dbResult = mysql_query(
"SELECT CAST(SUM(`AcctInputOctets`) + SUM(`AcctOutputOctets`) AS CHAR)".
"FROM radacct WHERE UserName = '00-00-00-00-00-13'"
);
if(mysql_num_rows($dbResult)){
$res = mysql_fetch_array($dbResult,MYSQL_NUM);
/* insert HTML here */
$nRes = bcHighPow(bcmul($res[0],'8'));
echo $nRes[0]." ".$nRes[1];
}else
echo 'No data found';
mysql_free_result($dbResult);
mysql_close($db);
?>
More information about the Freeradius-Users
mailing list