From 0dd6af01d5a5456c8776b1fa701c48a684a1cdf9 Mon Sep 17 00:00:00 2001 From: antux18 Date: Wed, 28 Jun 2023 20:59:12 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20de=20la=20r=C3=A9solution=20du=20p?= =?UTF-8?q?uzzle.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- answer.php | 32 ++++++++++---------------------- article.php | 3 +++ puzzles.php | 3 +++ 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/answer.php b/answer.php index 46b6201..9e54e21 100644 --- a/answer.php +++ b/answer.php @@ -1,42 +1,30 @@ pdo_article->prepare("SELECT * FROM puzzles WHERE id == :id"); + + // Recherche de l'énigme avec son code : + $stmt = $database->pdo_article->prepare("SELECT * FROM puzzles WHERE (id == :id AND code == :code)"); $stmt->bindValue(":id", $art_id); - $stmt->execute(); - $article = $stmt->fetch(); - - // Vérification de l'existence du groupe et de l'énigme : - $stmt = $database->pdo_teams->prepare("SELECT * FROM teams WHERE id == :id"); - $stmt->bindValue(":id", $team_id); - $stmt->execute(); - - if (empty($article) || empty($stmt->fetchAll())) { - header("Location: index.php"); - die(); - } - - $stmt = $database->pdo_article->prepare("SELECT * FROM puzzles WHERE code == :code"); $stmt->bindValue(":code", htmlspecialchars($_GET["code"])); $stmt->execute(); $article = $stmt->fetch(); - // Vérification de l'existence du groupe : + // Recherche du groupe : $stmt = $database->pdo_teams->prepare("SELECT * FROM teams WHERE id == :id"); $stmt->bindValue(":id", $team_id); $stmt->execute(); - if (empty($stmt->fetchAll())) { - header("Location: index.php"); - die(); - } - - if (empty($article)) { + // Vérification de l'existence du groupe, et de la combinaison ID énigme + code : + if (empty($article) || empty($stmt->fetchAll())) { echo 0; } diff --git a/article.php b/article.php index 2f7c04a..ed8a8cd 100644 --- a/article.php +++ b/article.php @@ -2,6 +2,9 @@ require_once "require/base.php"; $article = array(); + $solved = false; + $team_id = -1; + $art_id = -1; $database = new Database(); diff --git a/puzzles.php b/puzzles.php index fd9c42c..b1129cb 100644 --- a/puzzles.php +++ b/puzzles.php @@ -1,6 +1,9 @@