-
Notifications
You must be signed in to change notification settings - Fork 0
/
Connexion.php
91 lines (72 loc) · 3.19 KB
/
Connexion.php
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
include('menu.php');
include('db_config.php');
// Récupération des éléments du formulaire
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$email = $_POST["email"];
$password = $_POST["password"];
$stmt_get_pwd = $connection->prepare("SELECT association_id, hash_password FROM Associations WHERE mail_address = ?");
$stmt_get_pwd->bind_param("s", $email);
$stmt_get_pwd->execute();
$result = $stmt_get_pwd->get_result();
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$association_id = $row['association_id'];
$hash_password = $row['hash_password'];
// Vérification si le mot de passe correspond au mot de passe haché dans la base de données
if (password_verify($password, $hash_password)) {
header("Location: Gestion.php?association_id=$association_id");
exit;
} else {
echo "<script>alert('Erreur : Le mot de passe saisi est incorrect.');</script>";
}
} else {
echo "<script>alert('Erreur : L\'adresse e-mail saisie est incorrecte.');</script>";
}
$stmt_connection->close();
}
if (isset($_GET['error']) && $_GET['error'] == 'not_logged_in') {
echo "<script>alert('Connectez-vous afin d\'accéder à la page de gestion.');</script>";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $page_name ?></title>
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $logo ?>">
<link href="style.css" rel="stylesheet"/>
</head>
<body>
<div class="menu_site"><?php echo $menu_site ?></div>
<div style="margin-bottom: 20px;"></div>
<center><img class="logo" src="<?php echo $logo ?>"></center>
<div style="margin-bottom: 30px;"></div>
<div class="name_rectangle">
<h1><?php echo $page_name ?></h1>
</div>
<div style="margin-bottom: 25px;"></div>
<center><h2>Connectez-vous afin de gérer le site de votre association</h2></center>
<div style="margin-bottom: 50px;"></div>
<div class="separation_rectangle"></div>
<div style="margin-bottom: 50px;"></div>
<div class="content_rectangle">
<div class="content">
<center>
<h1>Accédez à votre espace de gestion</h1><br>
<div class="formulaire">
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
<h3>
<label for="email">Adresse mail :</label>
<input type="text" id="email" name="email" required><br>
<label for="password">Mot de passe :</label>
<input type="password" id="password" name="password" required><br>
</h3>
<input class="bouton" type="submit" value="Se connecter">
</form>
</div>
</center>
</div>
</div>
</body>
</html>