Billing Meter bit.ly link or Billing Meter tech0x20 link.
This isn’t perfect. First of all, some connections are just too slow for a constant refresh rate of less than 20-30 seconds. Secondly, I think many mobile browsers have a refresh cut-off at which point they will ask you if you really want to keep refreshing.
The first page, index.php, allows you to enter parameters:
?>
Billing Meter
The second file, meter.php, does the display, calculation and refresh:
session_start();
if(strlen($_POST["BILLINGRATE"]))
{
$_SESSION["BILLINGRATE"] = (double)$_POST["BILLINGRATE"];
$_SESSION["REFRESHRATE"] = (int)$_POST["REFRESHRATE"];
if($_POST["STARTTIME"] == "-1")
{
$_SESSION["STARTTIME"] = time();
}
}
echo "";
$netseconds = time()-$_SESSION["STARTTIME"];
$cost = sprintf("%10.2lf", round($_SESSION["BILLINGRATE"]*((double)$netseconds)/3600.0,2));
?>
Billing meter
Time spent:
$time_counter = sprintf("%02d:%02d:%02d", $netseconds/3600, $netseconds / 60 % 60, $netseconds % 60);
?>
| ".$time_counter[$i]." |
Your bill:
| $ | ".$cost[$i]." |
Posts