From dc488aea4d9df68e32b0f0dfde312fe49588f848 Mon Sep 17 00:00:00 2001 From: adrien Date: Sat, 3 May 2025 14:48:54 +0200 Subject: [PATCH] =?UTF-8?q?renvoyer=20un=20num=C3=A9ro=20de=20grille=20seu?= =?UTF-8?q?lement=20si=20elle=20est=20valide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index cfc9b20..4e0238d 100644 --- a/index.php +++ b/index.php @@ -1,15 +1,9 @@ LARGEUR_MAX ] ]); -$id = htmlspecialchars($_GET["grille"]); + +if (isset($_GET["grille"])) { + $id = htmlspecialchars($_GET["grille"]); +} else { + $id = uniqid(); +} $grille = new Grille($hauteur, $largeur, $id); $grille->current(); if ($grille->valid()) { + if (!isset($_GET["grille"])) { + $_GET["grille"] = $id; + header("Location: " . dirname($_SERVER['DOCUMENT_URI']) . "?" . http_build_query($_GET)); + exit; + } + $definitions_horizontales = []; foreach ($grille->lignes as $y => $mots) { $definitions_horizontales[$y] = [];