Tether TNG utilization for user $name");
echo ("Tether TNG utilization for user $name
");
$sock=msqlConnect();
if ($sock<0) {echo("ERROR : $ERRMSG\n");}
if (msqlSelectDB($sock,"tether_calls")<0) {echo("ERROR : $ERRMSG\n");}
msqlQuery($sock,"select duration from sessions where user = '$name' or user = '$name.dialup'");
$res=msqlStoreResult();
$numcalls=msqlNumRows($res);
if ($numcalls > 0)
{
$j=0;
$useage=0;
while ($j < $numcalls)
{
$row=msqlFetchRow($res);
$useage = $useage+(int)$row[0];
$j = $j + 1;
}
msqlFreeResult($res);
$useage = (int)($useage / 60);
$average = (int)($useage / $numcalls);
$overtime = 0;
if ($useage > 6000)
{
$overtime = (int)($useage - 6000.0);
}
$charge = 15 + ($overtime/120);
echo("
");
echo ("Number of calls: $numcalls
Minutes used: $useage
Average call length: $average
Number of minutes over 100 hours: $overtime
Current charge: \$$charge.00
");
msqlClose($sock);
echo("
Itemized calls.
");
}
else
{
echo ("
No calls were found in the database
");
}
>