Mobile Billing MeterPosted: March 14, 2009 | Author: tech0x20 | Filed under: bookmarks, php, programming | Tags: billing, fun | Leave a comment »
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:
The second file, meter.php, does the display, calculation and refresh:
$netseconds = time()-$_SESSION["STARTTIME"];
$cost = sprintf("%10.2lf", round($_SESSION["BILLINGRATE"]*((double)$netseconds)/3600.0,2));
$time_counter = sprintf("%02d:%02d:%02d", $netseconds/3600, $netseconds / 60 % 60, $netseconds % 60); ?>