63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
require_once "require/base.php";
|
|
|
|
$database = new Database();
|
|
|
|
// Si l'appareil a déjà choisi une équipe, on le redirige vers la bonne page :
|
|
if (isset($_COOKIE["team"])) {
|
|
$team_id = htmlspecialchars($_COOKIE["team"]);
|
|
|
|
if ($database->checkTeamExists($team_id)) {
|
|
header("Location: puzzles.php?team=" . $team_id);
|
|
die();
|
|
}
|
|
|
|
else {
|
|
$stmt = $database->pdo_teams->prepare("SELECT * FROM teams");
|
|
$stmt->execute();
|
|
$teams = $stmt->fetchAll();
|
|
}
|
|
}
|
|
|
|
// Sinon, on affiche la liste des équipes :
|
|
else {
|
|
$stmt = $database->pdo_teams->prepare("SELECT * FROM teams");
|
|
$stmt->execute();
|
|
$teams = $stmt->fetchAll();
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<?php
|
|
require_once $rq_path . "head.php";
|
|
?>
|
|
<title><?= $tr["tab_title"]["home"]?></title>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<?php
|
|
require_once $rq_path . "nav.php";
|
|
?>
|
|
</header>
|
|
<main>
|
|
<header>
|
|
<h1><?= $tr["page_title"]["home"]?></h1>
|
|
<h2><?= $tr["home"]["subtitle"]?></h2>
|
|
</header>
|
|
<article>
|
|
<p><?= $tr["home"]["message"]?></p>
|
|
<form action="team_confirm.php" method="get">
|
|
<input type="number" name="team" placeholder="<?= $tr['home']['team'] ?>">
|
|
<button type="submit"><?= $tr["home"]["button"] ?></button>
|
|
</form>
|
|
</article>
|
|
</main>
|
|
<footer>
|
|
<?php
|
|
require_once $rq_path . "footer.php";
|
|
?>
|
|
</footer>
|
|
</body>
|
|
</html>
|