-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValider_connexion.php
More file actions
34 lines (29 loc) · 1.07 KB
/
Valider_connexion.php
File metadata and controls
34 lines (29 loc) · 1.07 KB
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
29
30
31
32
33
34
<?php
session_start();
require_once("Connexion.php");
if (isset($_POST['email']) && isset($_POST['password'])) {
$email = htmlspecialchars($_POST['email']);
$pass = htmlspecialchars($_POST['password']);
$result = $bd->prepare('SELECT pseudo, email, password FROM utilisateurs WHERE email= ?');
$result->execute(array($email));
$data = $result->fetch();
$row = $result->rowCount();
if ($row == 1) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$password = hash('sha256',$pass);
if ($data['password'] === $pass) {
$_SESSION['user'] = $data['pseudo'];
header('Location:Chat.php');
}
else
header('Location:Accueil.php?login_err=password');
}
else
header('Location:Accueil.php?login_err=email');
}
else
header('Location:Accueil.php?login_err=already');
}
else
header('Location:Accueil.php');
?>