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(Exception $e){
- die('Erreur : '.$e->getMessage());
- }
- $result = $bdd->prepare("SELECT password FROM Users WHERE login = :user");
- $result->execute(array(':user'=>$username));
- $data = $result->fetch();
- if(password_verify($password, $data['password'])){
- $_SESSION['login'] = $username;
- header("Location: calendar_custom.php");
- exit;
- }
- else{
- $_SESSION['error'] = "LOGIN or PASSWORD is invalid.";
- header("Location: affiche.php");
- exit;
- }
- $result->closeCursor();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement