2023-06-27 14:31:55 +02:00
|
|
|
<?php
|
|
|
|
require_once "require/base.php";
|
|
|
|
|
|
|
|
$article = array();
|
2023-06-28 20:59:12 +02:00
|
|
|
$solved = false;
|
|
|
|
$team_id = -1;
|
|
|
|
$art_id = -1;
|
2023-06-27 14:31:55 +02:00
|
|
|
|
|
|
|
$database = new Database();
|
|
|
|
|
2023-06-28 20:38:52 +02:00
|
|
|
if (isset($_GET["id"]) && isset($_GET["team"])) {
|
|
|
|
$art_id = htmlspecialchars($_GET["id"]);
|
|
|
|
$team_id = htmlspecialchars($_GET["team"]);
|
|
|
|
$stmt = $database->pdo_article->prepare("SELECT * FROM puzzles WHERE id == :id");
|
|
|
|
$stmt->bindValue(":id", $art_id);
|
2023-06-27 14:31:55 +02:00
|
|
|
$stmt->execute();
|
|
|
|
$article = $stmt->fetch();
|
2023-06-28 20:38:52 +02:00
|
|
|
|
|
|
|
// 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();
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
$stmt = $database->pdo_teams->prepare("SELECT * FROM solved WHERE (team_id == :team_id AND puzzle_id == :puzzle_id)");
|
|
|
|
$stmt->bindValue(":team_id", $team_id);
|
|
|
|
$stmt->bindValue(":puzzle_id", $art_id);
|
|
|
|
$stmt->execute();
|
|
|
|
$solved = !empty($stmt->fetch());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
header("Location: index.php");
|
|
|
|
die();
|
2023-06-27 14:31:55 +02:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
|
|
<?php
|
|
|
|
require_once $rq_path . "head.php";
|
|
|
|
?>
|
2023-06-28 20:38:52 +02:00
|
|
|
<title><?= $tr["tab_title"]["article"] ?></title>
|
|
|
|
<script type="module" src="<?= $rq_path ?>js/qrscan.js"></script>
|
2023-06-27 14:31:55 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header>
|
|
|
|
<?php
|
|
|
|
require_once $rq_path . "nav.php";
|
|
|
|
?>
|
|
|
|
</header>
|
|
|
|
<main>
|
|
|
|
<header>
|
2023-07-27 13:10:52 +02:00
|
|
|
<h1><?= $tr["page_title"]["article"] . $art_id . " : " . $article["title"] ?></h1>
|
2023-06-28 20:38:52 +02:00
|
|
|
<p><?= $article["text"] ?></p>
|
2023-06-27 14:31:55 +02:00
|
|
|
</header>
|
|
|
|
<article>
|
2023-06-28 20:38:52 +02:00
|
|
|
<?php if ($solved) : ?>
|
|
|
|
<p><?= $tr["article"]["success"] ?></p>
|
2023-07-11 12:24:33 +02:00
|
|
|
<p><?= $article["answer"] ?></p>
|
|
|
|
<p><?= $article["location"] ?></p>
|
2023-06-28 20:38:52 +02:00
|
|
|
<?php else : ?>
|
|
|
|
<p><?= $tr["article"]["message"] ?></p>
|
|
|
|
<p></p> <!-- Emplacement du message d'erreur JS concernant la caméra. !-->
|
|
|
|
<button><?= $tr["article"]["qr_but"] ?></button>
|
|
|
|
<video></video>
|
|
|
|
<p><?= $tr["article"]["cam_sel"] ?></p>
|
|
|
|
<select>
|
|
|
|
<option value="rear" selected><?= $tr["article"]["r_cam"] ?></option>
|
|
|
|
<option value="front"><?= $tr["article"]["f_cam"] ?></option>
|
|
|
|
</select>
|
|
|
|
<!-- <p>Scanner depuis un fichier</p>
|
|
|
|
<input type="file" id="file-selector"> -->
|
|
|
|
<?php endif; ?>
|
2023-06-27 14:31:55 +02:00
|
|
|
</article>
|
|
|
|
</main>
|
|
|
|
<footer>
|
|
|
|
<?php
|
|
|
|
require_once $rq_path . "footer.php";
|
|
|
|
?>
|
|
|
|
</footer>
|
|
|
|
</body>
|
|
|
|
</html>
|