Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $username = htmlspecialchars($_POST['login'],ENT_QUOTES);
- $password = htmlspecialchars($_POST['password'],ENT_QUOTES);
- try{
- $bdd = new PDO('mysql:host=localhost;dbname=calendar;charset=utf8', 'root', 'isencir');
- $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- } catch(PDOException $e) {
- }
- catch(Exception $e){
- die('Erreur : '.$e->getMessage());
- }
- $result = $bdd->prepare("SELECT password FROM Users WHERE login = :username");
- $result->bindParam(':username',$username);
- $result->execute();
- $data = $result->fetch(PDO::FETCH_ASSOC);
- if(password_verify($password, $data['password'])){
- if($username =='customer'){
- header("Location: calendar_custom.php");
- exit;
- }
- else if($username=='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