Correction de la résolution du puzzle.

This commit is contained in:
antux18 2023-06-28 20:59:12 +02:00
parent 35c9aeaae5
commit 0dd6af01d5
3 changed files with 16 additions and 22 deletions

View File

@ -1,42 +1,30 @@
<?php
require_once "require/base.php";
$team_id = -1;
$art_id = -1;
$article = array();
$database = new Database();
if (isset($_GET["code"]) && isset($_GET["team"]) && isset($_GET["id"])) {
$art_id = htmlspecialchars($_GET["id"]);
$team_id = htmlspecialchars($_GET["team"]);
$stmt = $database->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;
}

View File

@ -2,6 +2,9 @@
require_once "require/base.php";
$article = array();
$solved = false;
$team_id = -1;
$art_id = -1;
$database = new Database();

View File

@ -1,6 +1,9 @@
<?php
require_once "require/base.php";
$puzzles = array();
$team_id = -1;
$database = new Database();
if (isset($_GET["team"])) {