1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <?php
session_start();
require_once 'config.php';
if(!empty($_POST['email']) && !empty($_POST['password']))
{
$email = htmlspecialchars($_POST['email']);
$password = htmlspecialchars($_POST['password']);
$check = $bdd->prepare('SELECT pseudo, email, password FROM utilisateurs WHERE email = ?');
$check->execute(array($email));
$data = $check->fetch();
$row = $check->rowCount();
if($row == 1)
{
if(filter_var($email, FILTER_VALIDATE_EMAIL))
{
if(password_verify($password, $data['password']))
{
$_SESSION['user'] = $data['email'];
header('Location: accueil-peche-perle.php');
die();
}else{ header('Location: index.php?login_err=password'); die(); }
}else{ header('Location: index.php?login_err=email'); die(); }
}else{ header('Location: index.php?login_err=already'); die(); }
} |
Partager