Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $username = htmlspecialchars($_POST['login'],ENT_QUOTES,ISO-8859-15);
- $password = htmlspecialchars($_POST['password'],ENT_QUOTES,ISO-8859-15);
- try{
- $bdd = new PDO('mysql:host=localhost;dbname=calendar;charset=utf8', 'root', 'isencir');
- } catch(PDOException $e) {
- }
- catch(Exception $e){
- die('Erreur : '.$e->getMessage());
- }
- $result = $bdd->prepare("SELECT login,password FROM Users WHERE login = :user");
- $result->execute(array(':user'=>$username));
- $data = $result->fetch();
- if(password_verify($password, $data['password'])){
- $_SESSION['login'] = $data['login'];
- if($_SESSION['login'] ==='customer'){
- header("Location: calendar_custom.php");
- exit;
- }
- else if($_SESSION['login']==='organizer'){
- header("Location: essai_affich_calendar.php");
- exit;
- }
- }
- else{
- $_SESSION['error'] = "LOGIN or PASSWORD is invalid.";
- header("Location: affiche.php");
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement