2003-10-15 08:47:13 +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";
|
2004-06-07 03:34:07 +00:00
|
|
|
$offset = $_GET["offset"];
|
|
|
|
if (!$offset) $offset=0;
|
|
|
|
|
2004-06-30 18:53:35 +00:00
|
|
|
if ($offset % $n) $offset = 0;
|
|
|
|
|
2004-06-07 03:34:07 +00:00
|
|
|
if ($offset < 1000) {
|
|
|
|
$cache_args = "sort_by=$sort_by&offset=$offset";
|
2004-07-22 23:42:50 +00:00
|
|
|
start_cache(TOP_PAGES_TTL, $cache_args);
|
2004-06-24 16:51:22 +00:00
|
|
|
} else {
|
|
|
|
page_head("Limit exceeded");
|
|
|
|
echo "Sorry - first 1000 only.";
|
|
|
|
page_tail();
|
2004-07-15 18:54:17 +00:00
|
|
|
exit();
|
2004-06-07 03:34:07 +00:00
|
|
|
}
|
2004-04-14 20:55:37 +00:00
|
|
|
|
|
|
|
require_once("../inc/db.inc");
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once("../inc/user.inc");
|
2002-11-08 17:21:45 +00:00
|
|
|
|
2004-06-07 03:34:07 +00:00
|
|
|
db_init();
|
|
|
|
page_head("Top participants");
|
2003-09-08 00:12:37 +00:00
|
|
|
if ($sort_by == "total_credit") {
|
2004-05-27 18:13:00 +00:00
|
|
|
$sort_order = "total_credit desc";
|
2003-09-08 00:12:37 +00:00
|
|
|
} else {
|
2004-05-27 18:13:00 +00:00
|
|
|
$sort_order = "expavg_credit desc";
|
2003-09-08 00:12:37 +00:00
|
|
|
}
|
2004-04-14 20:55:37 +00:00
|
|
|
|
2004-08-11 11:24:49 +00:00
|
|
|
$result = mysql_query("select * from user order by $sort_order limit $offset,$n");
|
2004-05-31 00:50:06 +00:00
|
|
|
user_table_start($sort_by);
|
2004-06-07 03:34:07 +00:00
|
|
|
$i = 1 + $offset;
|
2002-11-08 17:21:45 +00:00
|
|
|
while ($user = mysql_fetch_object($result)) {
|
2004-06-07 03:34:07 +00:00
|
|
|
show_user_row($user, $i);
|
|
|
|
$i++;
|
2002-11-08 17:21:45 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2004-06-07 03:34:07 +00:00
|
|
|
|
|
|
|
if ($offset > 0) {
|
|
|
|
$new_offset = $offset - $n;
|
|
|
|
echo "<a href=top_users.php?sort_by=$sort_by&offset=$new_offset>Previous $n</a> | ";
|
|
|
|
|
|
|
|
}
|
|
|
|
$new_offset = $offset + $n;
|
|
|
|
echo "<a href=top_users.php?sort_by=$sort_by&offset=$new_offset>Next $n</a>";
|
2002-11-08 17:21:45 +00:00
|
|
|
page_tail();
|
2004-04-14 20:55:37 +00:00
|
|
|
|
2004-06-07 03:34:07 +00:00
|
|
|
if ($offset < 1000) {
|
2004-07-23 04:04:21 +00:00
|
|
|
end_cache(TOP_PAGES_TTL,$cache_args);
|
2004-06-07 03:34:07 +00:00
|
|
|
}
|
2003-10-15 08:47:13 +00:00
|
|
|
} ?>
|