From ed4c530f8d0e385122062fe4c00e9e229dd624b6 Mon Sep 17 00:00:00 2001 From: adplantade Date: Sun, 16 Aug 2020 11:41:29 +0200 Subject: [PATCH] =?UTF-8?q?correction=20requ=C3=AAte=20index=20qui=20ne=20?= =?UTF-8?q?se=20fait=20pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + correction logo pour adapter aux droits --- code/index.php | 72 +++++++++++++++++++++++++-------------- code/ress/logo_clair.png | Bin 13700 -> 14236 bytes code/ress/logo_dark.png | Bin 15109 -> 15820 bytes code/vitraux.js | 6 ++-- 4 files changed, 49 insertions(+), 29 deletions(-) diff --git a/code/index.php b/code/index.php index b86ba04..504d1b1 100644 --- a/code/index.php +++ b/code/index.php @@ -142,45 +142,65 @@ $database = new SQLite3("data.db"); -// echo isset($_POST["game_mode"])." ".isset($_POST["difficulty"])." ".isset($_POST["dotsAmount"])." ".isset($_POST["pause"]); +//$ph = $_POST["game_mode"]."|".$_POST["difficulty"]."|".$_POST["dotsAmount"]."|".$_POST["pause"]; +//echo "

".$ph."

"; + $toDisp=5; if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]!="" && $_POST["dotsAmount"]!="" && $_POST["pause"]!="") { - if(stristr($_POST['game_mode'], "p") === FALSE) - { - $sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' order by score desc limit '.$toDisp; - $unit="points"; - } - else - { - $sql='select score, player from score where game_mode="'.$_POST['game_mode'].'" and difficulty="'.$_POST['difficulty'].'" and dots_amount='.$_POST["dotsAmount"].' and pause='.$_POST["pause"].' order by score asc limit '.$toDisp; - $unit="secondes"; - } - $result = $database->query($sql); - $a=$result->fetchArray(); + $db_game_mode=$_POST["game_mode"]; + $db_difficulty=$_POST["difficulty"]; + $db_dotsAmount=$_POST["dotsAmount"]; + $db_pause=$_POST["pause"]; +} +else +{ + $db_game_mode="5p"; + $db_difficulty="easy"; + $db_dotsAmount=$_COOKIE["dotsAmount"]; + $db_pause=$_COOKIE["pause"]; +} - if($a==false) - { - $phrase= "Il n'y a pas encore de score pour ce mode de jeu."; - } - else - { - $phrase="1° ".$a["player"].", ".$a[0]." ".$unit; - $cpt=2; - while ($row = $result->fetchArray()) { +if(stristr($db_game_mode, "p") === FALSE) +{ + $sql='select score, player from score where game_mode="'.$db_game_mode.'" and difficulty="'.$db_difficulty.'" and dots_amount='.$db_dotsAmount.' and pause='.$db_pause.' order by score desc limit '.$toDisp; + $unit="points"; +} +else +{ + $sql='select score, player from score where game_mode="'.$db_game_mode.'" and difficulty="'.$db_difficulty.'" and dots_amount='.$db_dotsAmount.' and pause='.$db_pause.' order by score asc limit '.$toDisp; + $unit="secondes"; +} +$result = $database->query($sql); +$a=$result->fetchArray(); - $phrase=$phrase."
".$cpt."° ".$row["player"].", ".$row["score"]." ".$unit; - $cpt++; - } +if($a==false) +{ + $phrase= "Il n'y a pas encore de score pour ce mode de jeu."; +} +else +{ + $phrase="1° ".$a["player"].", ".$a[0]." ".$unit; + $cpt=2; + while ($row = $result->fetchArray()) { + + $phrase=$phrase."
".$cpt."° ".$row["player"].", ".$row["score"]." ".$unit; + $cpt++; + } } - echo "

".$phrase."

"; +echo "

".$phrase."

"; + +if(isset($_POST["game_mode"]) && $_POST["game_mode"]!="" && $_POST["difficulty"]!="" && $_POST["dotsAmount"]!="" && $_POST["pause"]!="") +{ echo ""; echo ""; echo ""; echo ""; } + + ?>