2002-11-12 17:01:16 +00:00
|
|
|
<?php
|
|
|
|
require_once("util.inc");
|
|
|
|
require_once("user.inc");
|
|
|
|
|
|
|
|
function host_table_start() {
|
|
|
|
echo <<<EOT
|
|
|
|
<table border=1 cellpadding=6>
|
|
|
|
<tr><th>Owner</th>
|
|
|
|
<th>Total credit</th>
|
|
|
|
<th>Recent average credit</th>
|
|
|
|
<th>CPU type</th>
|
|
|
|
</tr>
|
|
|
|
EOT;
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_host_row($host) {
|
2002-12-06 21:37:30 +00:00
|
|
|
$result = mysql_query("select * from user where id = $host->userid");
|
2002-11-12 17:01:16 +00:00
|
|
|
$user = mysql_fetch_object($result);
|
|
|
|
mysql_free_result($result);
|
|
|
|
echo "<tr>
|
|
|
|
<td><a href=show_user.php?id=$user->id>$user->name</a></td>
|
|
|
|
<td>$host->total_credit</td>
|
|
|
|
<td>$host->expavg_credit</td>
|
|
|
|
<td>$host->p_vendor $host->p_model</td>
|
|
|
|
</tr>";
|
|
|
|
}
|
|
|
|
|
2003-01-23 19:20:14 +00:00
|
|
|
$max_hosts_display = 100;
|
2002-11-12 17:01:16 +00:00
|
|
|
db_init();
|
|
|
|
page_head("Top hosts");
|
2003-01-23 19:20:14 +00:00
|
|
|
$result = mysql_query("select * from host order by expavg_credit desc limit $max_hosts_display");
|
2002-11-12 17:01:16 +00:00
|
|
|
host_table_start();
|
2003-01-23 19:20:14 +00:00
|
|
|
while (($host = mysql_fetch_object($result)) && $max_hosts_display > 0) {
|
2002-11-12 17:01:16 +00:00
|
|
|
show_host_row($host);
|
2003-01-23 19:20:14 +00:00
|
|
|
$max_hosts_display--;
|
2002-11-12 17:01:16 +00:00
|
|
|
}
|
|
|
|
mysql_free_result($result);
|
|
|
|
echo "</table>\n";
|
|
|
|
page_tail();
|
|
|
|
?>
|