2002-11-12 17:01:16 +00:00
|
|
|
<?php
|
2003-08-22 05:36:25 +00:00
|
|
|
require_once("db.inc");
|
2002-11-12 17:01:16 +00:00
|
|
|
require_once("util.inc");
|
2003-03-17 22:37:49 +00:00
|
|
|
require_once("host.inc");
|
2002-11-12 17:01:16 +00:00
|
|
|
|
2003-11-30 21:05:57 +00:00
|
|
|
$n = 10;
|
|
|
|
$offset = $_GET["offset"];
|
|
|
|
if (!$offset) $offset=0;
|
|
|
|
|
2002-11-12 17:01:16 +00:00
|
|
|
db_init();
|
2003-03-19 21:01:32 +00:00
|
|
|
page_head("Top computers");
|
2003-09-08 00:12:37 +00:00
|
|
|
$sort_by = $_GET["sort_by"];
|
|
|
|
if ($sort_by == "total_credit") {
|
2003-11-30 21:05:57 +00:00
|
|
|
$sort_clause = "total_credit desc, total_credit desc";
|
2003-09-08 00:12:37 +00:00
|
|
|
} else {
|
2003-11-30 21:05:57 +00:00
|
|
|
$sort_clause = "expavg_credit desc, total_credit desc";
|
2003-09-08 00:12:37 +00:00
|
|
|
}
|
2003-11-30 21:05:57 +00:00
|
|
|
$result = mysql_query("select * from host order by $sort_clause limit $n offset $offset");
|
2003-03-19 21:01:32 +00:00
|
|
|
host_table_start("Top computers", false);
|
2003-11-30 21:05:57 +00:00
|
|
|
$i = $offset+1;
|
|
|
|
while ($host = mysql_fetch_object($result)) {
|
2003-03-19 21:01:32 +00:00
|
|
|
show_host_row($host, $i, false);
|
2003-03-17 22:37:49 +00:00
|
|
|
$i++;
|
2002-11-12 17:01:16 +00:00
|
|
|
}
|
|
|
|
mysql_free_result($result);
|
|
|
|
echo "</table>\n";
|
2003-11-30 21:05:57 +00:00
|
|
|
if ($offset > 0) {
|
|
|
|
$new_offset = $offset - $n;
|
|
|
|
echo "<a href=top_hosts?sort_by=$sort_by&offset=$new_offset>Last $n</a> | ";
|
|
|
|
|
|
|
|
}
|
|
|
|
$new_offset = $offset + $n;
|
|
|
|
echo "<a href=top_hosts?sort_by=$sort_by&offset=$new_offset>Next $n</a>";
|
2002-11-12 17:01:16 +00:00
|
|
|
page_tail();
|
|
|
|
?>
|