$erreur
"; } } function getError($code){ switch ($code){ case 1: return "Adresse mail ou mot de passe invalide."; } } function authentification($mail, $password){ global $db; $result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail)); if ($result){ $row = pg_fetch_array($result); return (strcmp($row["passwd"], $password)) == 0; } return false; } function init(){ global $db; session_start(); /*if(isset($_COOKIE['mail']) && isset($_COOKIE['password'])){ if (authentification($_COOKIE['mail'], $_COOKIE['mail'])){ $_SESSION['mail'] = $_COOKIE['mail']; } }*/ if(!isset($_SESSION['mail'])){ if (isset($_POST['mail_field'])){ $mail = strtolower(htmlentities(pg_escape_string ($_POST['mail_field']))); $password = htmlentities(pg_escape_string($_POST['password'])); $result = authentification($mail, $password); if($result) { $_SESSION['mail'] = $mail; header('Location: tableauBord/tableauBord.php'); exit(); } else { header('Location: index.php?error=1'); exit(); } } } else{ header('Location: tableauBord/tableauBord.php'); exit(); } } ?>Si vous n'avez pas de compte cliquez ici.