<?php require_once MODEL_PATH . 'userModel.php'; require_once MODEL_PATH . 'movieModel.php'; switch ($action) { case "connected": if (!isset($_GET['login'])) { $view = "error"; $pagetitle = "Erreur sur le mot de passe"; break; } $data = array("pseudo" => escape($_GET["login"])); $user = userModel::selectWhere($data); if (count($user) == 0) { $view = "error"; $pagetitle = "Erreur lors de la récupération des données de l'utilisateur"; } else { $zeUser = $user[0]; if ($zeUser->pseudo == escape($_GET['login']) && $zeUser->mdp == escape($_GET['mdp'])) { $_SESSION['login'] = escape($_GET['login']); if ($zeUser->admin == 1) { $_SESSION['admin'] = $zeUser->admin; } $allMovies = movieModel::selectAll(); $view = "home"; $controller = "movie"; } else { $view = "error"; $pagetitle = "Error on user"; } }