<legend>Sign in</legend> <label for="email">Email: </label> <input type="text" id="emailSign" name="emailSign" required/> <label for="passwordSign">Password: </label> <input type="password" id="passwordSign" name="passwordSign" required/> <label for="passwordSignRepete">Password: </label> <input type="password" id="passwordSignRepete" name="passwordSignRepete" required/> <label for="nameSign">Name: </label> <input type="text" id="nameSign" name="nameSign" required/> <input type="submit" name="btnsignin" value="Sign in"/> </fieldset> </form> <?php if (isset($_POST['btnconnect'])) { $controleur = new Controleur(); $result = $controleur->connectUser(htmlentities(addslashes($_POST['email'])), htmlentities(addslashes($_POST['password']))); switch ($result) { case 1: //c'est un admin $_SESSION['email'] = htmlentities(addslashes($_POST['email'])); $_SESSION['admin'] = 1; header('Location: home.php'); break; case 2: //user non admin $_SESSION['email'] = htmlentities(addslashes($_POST['email'])); header('Location: home.php'); break; case 3: echo "Connect fail"; break;