ratcatcher/website/hiscores/hiscores_plain.php

36 lines
818 B
PHP

<script language="php">
$easymode=$_GET['easymode'];
sqlite_escape_string($easymode);
function getworld($lev) {
$wnum = (int)(($lev-1)/20)+1;
$lnum = (int)($lev % 20);
if ($lnum == 0) return $lnum = 20;
return $wnum . "-" . $lnum;
}
if ($easymode) {
$db = sqlite_open("/var/www/html/ratcatcher.nethack.net/hiscores/hiscores.easy.db", 0666, $errorstr);
} else {
$db = sqlite_open("/var/www/html/ratcatcher.nethack.net/hiscores/hiscores.db", 0666, $errorstr);
}
$q = "select score, level, name from hiscores order by score desc";
$result = sqlite_query($db, $q);
header("Content-type: text/plain");
printf("start\n");
# loop through results
while ($row = sqlite_fetch_array($result)) {
printf("%d^%d^%s\n",$row["score"],$row["level"],$row["name"]);
}
printf("endofscores\n");
sqlite_close($db);
</script>