This repository was archived by the owner on Dec 9, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathadmin.php
More file actions
65 lines (61 loc) · 2.08 KB
/
Copy pathadmin.php
File metadata and controls
65 lines (61 loc) · 2.08 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
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
<?php
include("header.php");
include("mysql.php");
if(isset($_POST['valider'])) {
$matricule = htmlspecialchars($_POST['matricule']);
$password = password_hash(htmlspecialchars($_POST['password']), PASSWORD_BCRYPT);
if(!empty($matricule) AND !empty($password)) {
$requser = $bdd->prepare("SELECT * FROM utilisateurs WHERE matricule = ?");
$requser->execute(array($matricule));
$userexist = $requser->rowCount();
if(!$userexist == 1) {
$reqinscription = $bdd->prepare("INSERT INTO utilisateurs(matricule, password) VALUES(:matricule, :password)");
$reqinscription->execute(array(
'matricule' => $matricule,
'password' => $password
));
$confir = "L'enregistrement à bien était ajouté !";
} else {
$erreur = "Un utilisateur existe déjà avec ce matricule !";
}
} else {
$erreur = "Tous les champs doivent être complétés !";
}
}
?>
<!DOCTYPE html PUBLIC">
<html >
<head>
<meta charset ="utf-8"/>
<link rel="stylesheet" type="text/css" href="assets/style.css">
<script src="https://kit.fontawesome.com/0d56cf9e43.js" crossorigin="anonymous"></script>
<title>Authentification</title>
</head>
<body>
<div class="titre">
<i class="fa fa-refresh fa-spin fa-fw" aria-hidden="true"></i>
<a href="deconnexion.php"><span id="fa-solid fa-xmark" class="btnDeco">×</span></a>
<a href="index.php"><i class="fa-solid fa-house-user"></i></a>
<p>Authentification<p>
</div>
<div class="contenu">
<div class="zone_form">
<h3>Authentification</h3>
<form method="post" action="">
<p>
<input type="text" name="matricule" placeholder="Matricule" /><br><br>
<input type="password" name="password" placeholder="Mot de passe" />
</p>
<p>
<input type="submit" name="valider" value="Connexion">
</p>
</form>
<?php
if(isset($erreur)) {
echo '<font color="red">'.$erreur."</font>";
}
?>
</div>
</div>
</body>
</html>