diff --git a/html/user/brand_stats.php b/html/user/brand_stats.php new file mode 100644 index 0000000000..7cb1e6936d --- /dev/null +++ b/html/user/brand_stats.php @@ -0,0 +1,69 @@ +. + +// show statistics by client "brand" + +require_once("../inc/util.inc"); + +function show_form() { + page_head("Show statistics by client brand"); + echo " +
+ Select brand: +

+ HTP 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("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(); +} + +?>