This commit is contained in:
2023-07-11 09:25:11 +02:00
parent f6fa541f7f
commit 939513adfd
2 changed files with 31 additions and 1 deletions

30
server/getusers.php Normal file
View File

@@ -0,0 +1,30 @@
<?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 FROM userdata WHERE game LIKE '".$game."'";
$resultado = $bd->query($query);
$res = "";
$fila = $resultado->fetchArray(SQLITE3_ASSOC);
while ($fila) {
$res = $res.$fila['user'];
$fila = $resultado->fetchArray(SQLITE3_ASSOC);
if ($fila) $res = $res.",";
}
echo($res);
?>

View File

@@ -16,7 +16,7 @@ $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";
$query = "SELECT user, points FROM scores WHERE game LIKE '".$game."' ORDER BY points DESC";
$resultado = $bd->query($query);
$res = "";