Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/divers/TotalCounter.php
<?php
// THIS FILE SELECTS TOTAL USAGE JUST FOR FUN

$y=date('Y');
$m=date('m');

if ($fromdate=='') 
 $start=$y."-".$m."-01 00:00:00";
       
if ($todate=='') 
 $stop=date("Y-m-d")." 23:59:59";

$query="SELECT SUM(AcctSessionTime) AS TotalSessionTime, SUM($acctoutputoctetsattr) AS TotalOutputOctet, SUM($acctinputoctetsattr) AS TotalInputOctet,SUM($acctinputoctetsattr+$acctoutputoctetsattr) AS TotalOctet FROM `radacct`,userinfo WHERE radacct.UserName=userinfo.UserName AND AcctStopTime>='$start' AND AcctStopTime<='$stop' AND LocationID='".$_SESSION['locID']."'";
$result = $oreon->database->database->query($query) or die("Query database error !");
while($row = $oreon->database->database->fetch_object($result)) {
	$sec = $row->TotalSessionTime; // number of seconds
	$outputoctet=$row->TotalOutputOctet;
	$inputoctet=$row->TotalInputOctet;
	$totaloctet=$outputoctet+ $inputoctet;
}
?>

Return current item: phpMyPrepaid