diff --git a/Website/controllers/ControllerUser.php b/Website/controllers/ControllerUser.php index 1901dc0..07aaf83 100644 --- a/Website/controllers/ControllerUser.php +++ b/Website/controllers/ControllerUser.php @@ -282,17 +282,13 @@ class ControllerUser 'idplayer' => $_SESSION["idPlayerConnected"], 'maxscore' => $_SESSION["Score"] ]; - // var_dump($jouer); - // var_dump($this->mdPlayer->verifyJouer($jouer)); - // var_dump($this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)); - // var_dump($jouer['maxscore']); - // var_dump($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)); - // var_dump($jouer['maxscore'] >= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)); - - if ($this->mdPlayer->verifyJouer($jouer) == null) { - $this->mdPlayer->addJouer($jouer); - } else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) { - $this->mdPlayer->updateJouer($jouer); + + if($_SESSION["idPlayerConnected"] != null){ + if ($this->mdPlayer->verifyJouer($jouer) == null) { + $this->mdPlayer->addJouer($jouer); + } else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) { + $this->mdPlayer->updateJouer($jouer); + } } echo $this->twig->render($this->vues["viewScore"], [ @@ -344,10 +340,12 @@ class ControllerUser 'maxscore' => $_SESSION["Score"] ]; - if ($this->mdPlayer->verifyJouer($jouer) == null) { - $this->mdPlayer->addJouer($jouer); - } else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) { - $this->mdPlayer->updateJouer($jouer); + if($_SESSION["idPlayerConnected"] != null){ + if ($this->mdPlayer->verifyJouer($jouer) == null) { + $this->mdPlayer->addJouer($jouer); + } else if ($jouer['maxscore'] <= $this->mdPlayer->getMaxScoreByPlayerAndChapter($jouer)) { + $this->mdPlayer->updateJouer($jouer); + } } echo $this->twig->render($this->vues["viewScore"], [