$n"; } } db_init(); page_head("Result summary"); $server_state = array(); $outcome = array(); $client_state = array(); $nsecs = $_GET["nsecs"]; for ($ss=1; $ss<6; $ss++) { $server_state[$ss] = 0; } for ($ro=0; $ro<6; $ro++) { $outcome[$ro] = 0; } for ($cs=1; $cs<6; $cs++) { $client_state[$cs] = 0; } $x = $nsecs/3600.; echo "Results that have finished in last $x hours:\n"; $received_time = time() - $nsecs; $result = mysql_query("select * from result where received_time > $received_time"); $ntotal =0; // TODO: how to count $result? while ($res = mysql_fetch_object($result)) { $server_state[$res->server_state] += 1; $ntotal += 1; if ($res->server_state == 5) { $outcome[$res->outcome] += 1; if ($res->outcome == 3) { $client_state[$res->client_state] += 1; } } } mysql_free_result($result); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "

$ntotal results

'Over' results

'Client error' results

\n"; for ($ss=1; $ss<6; $ss++) { row2(result_server_state_string($ss), link_results($server_state[$ss], "result_server_state=$ss")); } echo "
Server state# results
\n"; for ($ro=0; $ro<6; $ro++) { c_row2(outcome_color($ro), result_outcome_string($ro), link_results($outcome[$ro], "result_outcome=$ro")); } echo "
Outcome# results
\n"; for ($cs=1; $cs<6; $cs++) { row2(result_client_state_string($cs), link_results($client_state[$cs], "result_client_state=$cs")); } print "
Client state# results
"; print "
"; page_tail(); } ?>