. // show statistics by client "brand" require_once("../inc/util.inc"); function show_form() { page_head("Show statistics by client brand"); echo "
Select brand:

HTC Power to Give

"; page_tail(); } function show_stats($brand) { switch ($brand) { case 1: $x = "HTC Power to Give"; break; default: error_page("invalid brand"); } $hosts = BoincHost::enum("os_name='Android' and serialnum like '%$x%'"); $n = 0; $t = 0; $a = 0; foreach($hosts as $h) { $t += $h->total_credit; $a += $h->expavg_credit; if ($h->expavg_credit > .1) $n++; } page_head("Stats for $x"); start_table(); row2("Active devices", $n); row2("Average daily credit", $a); row2("Total credit", $t); end_table(); page_tail(); } $brand = get_int("brand", true); if ($brand) { show_stats($brand); } else { show_form(); } ?>