diff --git a/WEB/Controller/EnigmeGateway.php b/WEB/Controller/EnigmeGateway.php index 9ecba86b..796e5c66 100644 --- a/WEB/Controller/EnigmeGateway.php +++ b/WEB/Controller/EnigmeGateway.php @@ -57,7 +57,7 @@ class EnigmeGateway WHERE points IS NOT NULL OR points != 0"; $this->con->executeQuery($query); $tabEnigme=EnigmeFactory::create($this->con->getResults()); - return $tabEnigme + return $tabEnigme; } public function findSoloEnigma(){ @@ -65,7 +65,7 @@ class EnigmeGateway WHERE points IS NULL OR points = 0"; $this->con->executeQuery($query); $tabEnigme=EnigmeFactory::create($this->con->getResults()); - return $tabEnigme + return $tabEnigme; } public function findById(string $idEnigme) : array diff --git a/WEB/Controller/UtilisateurGateway.php b/WEB/Controller/UtilisateurGateway.php index 136ebc06..91b86efd 100644 --- a/WEB/Controller/UtilisateurGateway.php +++ b/WEB/Controller/UtilisateurGateway.php @@ -48,17 +48,7 @@ class UtilisateurGateway ':email' => array($email,SQLITE3_TEXT) )); $results=$this->con->getResults(); - if ($results == null){ - return new Utilisateur("null", "null", "null", false); - } - foreach($results as $row) - { - $email = $row['email']; - $pseudo=$row['pseudo']; - $mdp = $row['mdp']; - $estAdmin = $row['estAdmin']; - } - return new Utilisateur($email, $pseudo, $mdp, $estAdmin); + return UtilisateurFactory::createUtilisateur($results); } public function getMdpByEmail(string $email) : string{ diff --git a/WEB/Factory/UtilisateurFactory.php b/WEB/Factory/UtilisateurFactory.php index 03c8b27f..860f6d63 100644 --- a/WEB/Factory/UtilisateurFactory.php +++ b/WEB/Factory/UtilisateurFactory.php @@ -2,7 +2,20 @@ class UtilisateurFactory { - public static function create(array $results){ + public static function createUtilisateur(array $results){ + if ($results == null){ + return new Utilisateur("null", "null", "null", false); + } + foreach($results as $row) + { + $email = $row['email']; + $pseudo=$row['pseudo']; + $mdp = $row['mdp']; + $estAdmin = $row['estAdmin']; + } + return new Utilisateur($email, $pseudo, $mdp, $estAdmin); + } + public static function createTabUtilisateur(array $results){ $tabUtilisateur=array(); foreach($results as $row) { @@ -10,5 +23,4 @@ class UtilisateurFactory } return $tabUtilisateur; } - } \ No newline at end of file diff --git a/WEB/index.php b/WEB/index.php index 468267f3..1b8647e6 100644 --- a/WEB/index.php +++ b/WEB/index.php @@ -6,8 +6,8 @@ Autoload::charger(); $control = new FrontController(); //session_regenerate_id(true); -session_unset(); -session_destroy(); -$_SESSION = null; +// session_unset(); +// session_destroy(); +// $_SESSION = null; //https://a-pellegrini.developpez.com/temp/tutoriels/php/security/session/#III.2 \ No newline at end of file