From 09f5cc7f92c30e515f3991d093a1da33feb24651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Garnier?= Date: Tue, 10 Jan 2023 07:32:29 +0100 Subject: [PATCH] =?UTF-8?q?Deuxi=C3=A8me=20essaie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WEB/Controller/UserController.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index 562ed042..a7208415 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -28,6 +28,9 @@ class UserController case "goToNext": $this->goToNext(); break; + case "goToGame": + $this->goToGame(); + break; case "enigmeEnded": $this->enigmeEnded(); break; @@ -193,15 +196,14 @@ class UserController $_SESSION['idPartie'] = $idPartie; $lesJoueurs = $model->getLesJoueurs($idPartie); if($etat == 1){ - // header("Location: index.php?action=launchGame"); - $this->goToGame($idPartie,1); + header("Location: index.php?action=goToGame&idPartie=" . $idPartie . "&index=1"); } else{ while ($etat == 0){ sleep(5); $etat = $model->getEtatPartie($idPartie); } - $this->goToGame($idPartie,1); + header("Location: index.php?action=goToGame&idPartie=" . $idPartie . "&index=1"); } } catch (Exception $e) { $error = $e->getMessage(); @@ -209,11 +211,13 @@ class UserController } } - public function goToGame(int $idPartie, int $index){ + public function goToGame(){ try { global $rep, $vues, $error; $model = new UserModel(); $utilisateur = $_SESSION['utilisateur']; + $idPartie = $_GET['idPartie']; + $index = $_GET['index']; $enigme = $model->getEnigmebyPartieIdAndIndex($idPartie, $index); $model->resoudreEnigmeMulti($utilisateur, $enigme->getIdEnigme(), $idPartie,); $code = $model->getCode($utilisateur->getEmail(), $enigme->getIdEnigme());