2002-11-12 17:01:16 +00:00
|
|
|
<?php
|
2004-04-14 20:55:37 +00:00
|
|
|
require_once("../inc/cache.inc");
|
2004-06-30 18:53:35 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
|
|
|
|
$n = 20;
|
2004-06-07 03:34:07 +00:00
|
|
|
|
2004-04-14 20:55:37 +00:00
|
|
|
$sort_by = $_GET["sort_by"];
|
|
|
|
if (!$sort_by) $sort_by = "expavg_credit";
|
|
|
|
$offset = $_GET["offset"];
|
|
|
|
if (!$offset) $offset=0;
|
|
|
|
|
2004-06-30 18:53:35 +00:00
|
|
|
if ($offset % $n) $offset = 0;
|
|
|
|
|
2004-04-14 20:55:37 +00:00
|
|
|
if ($offset < 1000) {
|
|
|
|
$cache_args = "sort_by=$sort_by&offset=$offset";
|
2004-06-30 18:53:35 +00:00
|
|
|
start_cache(12*3600, $cache_args);
|
2004-06-24 16:51:22 +00:00
|
|
|
} else {
|
|
|
|
page_head("Limit exceeded");
|
|
|
|
echo "Sorry - first 1000 only.";
|
|
|
|
page_tail();
|
|
|
|
|
2004-04-14 20:55:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
require_once("../inc/db.inc");
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once("../inc/host.inc");
|
2002-11-12 17:01:16 +00:00
|
|
|
|
|
|
|
db_init();
|
2004-05-11 22:49:23 +00:00
|
|
|
page_head("Top computers");
|
2003-09-08 00:12:37 +00:00
|
|
|
if ($sort_by == "total_credit") {
|
2004-05-31 00:50:06 +00:00
|
|
|
$sort_clause = "total_credit desc";
|
2003-09-08 00:12:37 +00:00
|
|
|
} else {
|
2004-05-31 00:50:06 +00:00
|
|
|
$sort_clause = "expavg_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");
|
2004-05-31 00:50:06 +00:00
|
|
|
top_host_table_start($sort_by);
|
2003-11-30 21:05:57 +00:00
|
|
|
$i = $offset+1;
|
|
|
|
while ($host = mysql_fetch_object($result)) {
|
2003-12-15 02:31:29 +00:00
|
|
|
show_host_row($host, $i, false, true);
|
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;
|
2004-04-14 20:55:37 +00:00
|
|
|
echo "<a href=top_hosts.php?sort_by=$sort_by&offset=$new_offset>Last $n</a> | ";
|
2003-11-30 21:05:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
$new_offset = $offset + $n;
|
2004-04-14 20:55:37 +00:00
|
|
|
echo "<a href=top_hosts.php?sort_by=$sort_by&offset=$new_offset>Next $n</a>";
|
2002-11-12 17:01:16 +00:00
|
|
|
page_tail();
|
2004-04-14 20:55:37 +00:00
|
|
|
|
|
|
|
if ($offset < 1000) {
|
|
|
|
end_cache($cache_args);
|
|
|
|
}
|
2002-11-12 17:01:16 +00:00
|
|
|
?>
|