-added server files

This commit is contained in:
2022-11-15 19:06:00 +01:00
parent ab1757f7cd
commit 32bdc6dcb6
8 changed files with 149 additions and 2 deletions

29
server/score-list.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
class MiBD extends SQLite3
{
function __construct()
{
$this->open('../bd/jailgames.db');
}
}
$bd = new MiBD();
$game = "";
if (isset($_GET['game'])) $game = $_GET['game'];
$query = "SELECT user, points FROM scores WHERE game LIKE '".$game."' ORDER BY points DESC LIMIT 10";
$resultado = $bd->query($query);
$res = "";
$fila = $resultado->fetchArray(SQLITE3_ASSOC);
while ($fila) {
$res = $res.$fila['user'].",".$fila['points']."\n";
$fila = $resultado->fetchArray(SQLITE3_ASSOC);
}
echo($res);
?>