ratcatcher/website/hiscores/submitscore.php

41 lines
824 B
PHP

<script language="php">
$score = $_GET['score'];
$name = $_GET['name'];
$level = $_GET['level'];
$easymode = $_GET['easymode'];
sqlite_escape_string($score);
sqlite_escape_string($name);
sqlite_escape_string($level);
sqlite_escape_string($easymode);
# construct new entry
# $newentry = sprintf("%-8s%-12s%-12s%s",$score,$name,$rank,$text);
# open hiscore database
if ($easymode) {
$db = sqlite_open("hiscores.easy.db", 0666, $errorstr);
} else {
$db = sqlite_open("hiscores.db", 0666, $errorstr);
}
# insert entry
$insert = sprintf("insert into hiscores (score, name, level) values (%d, '%s', %d);",$score, $name, $level);
$rv = sqlite_exec($db, $insert);
sqlite_close($db);
echo "<html>";
if ($rv == FALSE) {
echo "error submitting hiscore\n";
} else {
echo "hiscore submitted.";
}
echo "</html>";
</script>