Ajout d'une page de confirmation pour le choix de l'équipe.
Modification du style. Corrections mineures.
This commit is contained in:
parent
aed4b385dd
commit
ccb1d7e8f1
BIN
data/teams.db
BIN
data/teams.db
Binary file not shown.
@ -39,7 +39,7 @@
|
||||
<article>
|
||||
<ul>
|
||||
<?php foreach ($teams as $team) : ?>
|
||||
<li><a href="puzzles.php?team=<?= $team["id"] ?>"><?= $tr["home"]["team"] . $team["id"] ?></a></li>
|
||||
<li><a href="team_confirm.php?team=<?= $team["id"] ?>"><?= $tr["home"]["team"] . $team["id"] ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</article>
|
||||
|
24
puzzles.php
24
puzzles.php
@ -14,24 +14,22 @@
|
||||
$stmt->bindValue(":id", $team_id);
|
||||
$stmt->execute();
|
||||
|
||||
if (empty($stmt->fetchAll())) {
|
||||
if (empty($stmt->fetch())) {
|
||||
header("Location: index.php");
|
||||
die();
|
||||
}
|
||||
|
||||
else {
|
||||
// On crée un cookie pour enregistrer l'équipe sélectionnée si ce n'est pas fait :
|
||||
if (!isset($_COOKIE["team"])) {
|
||||
setcookie(
|
||||
"team",
|
||||
$team_id,
|
||||
time() + (365 * 24 * 60 * 60),
|
||||
"/",
|
||||
"",
|
||||
false,
|
||||
false
|
||||
);
|
||||
}
|
||||
// On crée un cookie pour enregistrer l'équipe sélectionnée :
|
||||
setcookie(
|
||||
"team",
|
||||
$team_id,
|
||||
time() + (365 * 24 * 60 * 60),
|
||||
"/",
|
||||
"",
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
// On vérifie si l'équipe a débloqué l'énigme bonus :
|
||||
$stmt = $database->pdo_teams->prepare("SELECT * FROM teams WHERE id = :id");
|
||||
|
@ -2,11 +2,13 @@
|
||||
$tr = [
|
||||
"tab_title" => [
|
||||
"home" => "Home - Lycée Pange Code Hunt",
|
||||
"team_confirm" => "Team confirmation - Lycée Pange Code Hunt",
|
||||
"puzzles" => "Puzzles list - Lycée Pange Code Hunt",
|
||||
"article" => "Puzzle - Lycée Pange Code Hunt"
|
||||
],
|
||||
"page_title" => [
|
||||
"home" => "Code Hunt",
|
||||
"team_confirm" => "Team confirmation",
|
||||
"puzzles" => "Puzzles list for team n°",
|
||||
"article" => "Puzzle n°"
|
||||
],
|
||||
@ -15,6 +17,11 @@
|
||||
"message" => "Select your team to begin :",
|
||||
"team" => "Team n°"
|
||||
],
|
||||
"team_confirm" => [
|
||||
"subtitle" => "Please make sure you selected the right team.",
|
||||
"message" => "Your name must appear on the following list : ",
|
||||
"button" => "Yes, this is my team !"
|
||||
],
|
||||
"article" => [
|
||||
"message" => "This puzzle describes a specific place. Head to that place, then scan the QR code you'll find there.",
|
||||
"success" => "Well done ! Your team solved this puzzle !",
|
||||
|
@ -2,11 +2,13 @@
|
||||
$tr = [
|
||||
"tab_title" => [
|
||||
"home" => "Accueil - Chasse au code Lycée Pange",
|
||||
"team_confirm" => "Confirmation du choix d'équipe - Chasse au code Lycée Pange",
|
||||
"puzzles" => "Liste des énigmes - Chasse au code Lycée Pange",
|
||||
"article" => "Énigme - Chasse au code Lycée Pange"
|
||||
],
|
||||
"page_title" => [
|
||||
"home" => "Chasse au code",
|
||||
"team_confirm" => "Confirmation du choix d'équipe",
|
||||
"puzzles" => "Liste des puzzles pour l'équipe n°",
|
||||
"article" => "Énigme n°"
|
||||
],
|
||||
@ -15,6 +17,11 @@
|
||||
"message" => "Pour commencer, veuillez choisir votre groupe :",
|
||||
"team" => "Équipe n°"
|
||||
],
|
||||
"team_confirm" => [
|
||||
"subtitle" => "Assurez-vous d'avoir sélectionné la bonne équipe.",
|
||||
"message" => "Votre nom doit figurer dans la liste suivante : ",
|
||||
"button" => "Oui, c'est bien mon équipe !"
|
||||
],
|
||||
"article" => [
|
||||
"message" => "Cette énigme décrit un endroit précis. Dirigez-vous vers cet endroit, puis scannez le QR code que vous-y trouverez.",
|
||||
"success" => "Bien joué ! Votre équipe a résolu cette énigme !",
|
||||
|
@ -4,6 +4,7 @@
|
||||
--bg-light: #a4a4a4;
|
||||
--fg: #ffffff;
|
||||
--hl: #8080ff;
|
||||
--hl-light: #aeaeff;
|
||||
}
|
||||
|
||||
body {
|
||||
@ -70,7 +71,7 @@ input[type="submit"], button {
|
||||
}
|
||||
|
||||
input[type="submit"]:hover, button:hover {
|
||||
background: var(--bg-light);
|
||||
background: var(--hl-light);
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
|
73
team_confirm.php
Normal file
73
team_confirm.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
require_once "require/base.php";
|
||||
|
||||
$team_id = -1;
|
||||
|
||||
$database = new Database();
|
||||
|
||||
if (isset($_GET["team"])) {
|
||||
$team_id = htmlspecialchars($_GET["team"]);
|
||||
|
||||
// Vérification de l'existence du groupe :
|
||||
$stmt = $database->pdo_teams->prepare("SELECT * FROM teams WHERE id == :id");
|
||||
$stmt->bindValue(":id", $team_id);
|
||||
$stmt->execute();
|
||||
|
||||
if (empty($stmt->fetch())) {
|
||||
header("Location: index.php");
|
||||
die();
|
||||
}
|
||||
|
||||
else {
|
||||
// Recherche des membres du groupe :
|
||||
$stmt = $database->pdo_teams->prepare("SELECT * FROM members WHERE team_id == :id");
|
||||
$stmt->bindValue(":id", $team_id);
|
||||
$stmt->execute();
|
||||
$members = $stmt->fetchAll();
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
header("Location: index.php");
|
||||
die();
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<?php
|
||||
require_once $rq_path . "head.php";
|
||||
?>
|
||||
<title><?= $tr["tab_title"]["team_confirm"] ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<?php
|
||||
require_once $rq_path . "nav.php";
|
||||
?>
|
||||
</header>
|
||||
<main>
|
||||
<header>
|
||||
<h1><?= $tr["page_title"]["team_confirm"] ?></h1>
|
||||
<p><?= $tr["team_confirm"]["subtitle"] ?></p>
|
||||
<p>
|
||||
<?= $tr["team_confirm"]["message"] ?>
|
||||
<?php foreach ($members as $member) : ?>
|
||||
<?= $member[0] ?>
|
||||
<?php endforeach; ?>
|
||||
</p>
|
||||
<a href="puzzles.php?team=<?= $team_id ?>">
|
||||
<button><?= $tr["team_confirm"]["button"] ?></button>
|
||||
</a>
|
||||
</header>
|
||||
<article>
|
||||
</article>
|
||||
</main>
|
||||
<footer>
|
||||
<?php
|
||||
require_once $rq_path . "footer.php";
|
||||
?>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user