/** * Affichage et controle de la page de connexion * */ public function connexionMembre() { session_start(); $meta['title'] = 'Connexion'; $meta['menu'] = 'connexion'; $userConnect = $this->userConnect(); $userConnectAdmin = $this->userConnectAdmin(); $msg['error'] = array(); $formulaire = new controleurFonctions(); $connexion = new modeleMembres(); if ($_POST) { if (isset($_POST['email']) && isset($_POST['mdp'])) { if (empty($_POST['email'])) { $msg['error']['email'] = 'Veuillez saisir votre <b>Email</b>.'; } if (empty($_POST['mdp'])) { $msg['error']['mdp'] = 'Veuillez saisir votre <b>mot de passe</b>.'; } if (empty($msg['error'])) { $email = htmlspecialchars($_POST['email'], ENT_QUOTES); $mdp = htmlspecialchars($_POST['mdp'], ENT_QUOTES); $donnees = $connexion->connexionMembre($email, $mdp); if ($donnees['email'] === $email && $donnees['mdp'] === $mdp) { foreach ($donnees as $key => $value) { if ($key != 'mdp') { $_SESSION['membre'][$key] = $value; } if (isset($_POST['remember'])) { setCookie('email', $email, time() + 365 * 24 * 3600); } } $userConnect = $this->userConnect(); $userConnectAdmin = $this->userConnectAdmin(); } else { $msg['error']['generale'] = 'Vos identifiants sont incorrects.'; } } } else { $msg['error']['generale'] = self::ERREUR_POST; } } // Gestion de la deconnexion si userConnect if ($userConnect) { if (isset($_GET['deconnexion']) && !empty($_GET['deconnexion']) && $_GET['deconnexion'] === 'true') { unset($_SESSION['membre']); $userConnect = FALSE; $userConnectAdmin = FALSE; $meta['deconnexion'] = TRUE; } } $this->Render('../vues/membres/connexion.php', array('meta' => $meta, 'msg' => $msg, 'userConnect' => $userConnect, 'userConnectAdmin' => $userConnectAdmin, 'formulaire' => $formulaire)); }