-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnexion.php
More file actions
27 lines (27 loc) · 1.06 KB
/
connexion.php
File metadata and controls
27 lines (27 loc) · 1.06 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
<?php
session_start();
if(isset($_POST['connexion'])) {
if(empty($_POST['pseudo'])) {
echo "Le champ Pseudo est vide.";
} else {
if(empty($_POST['mdp'])) {
echo "Le champ Mot de passe est vide.";
} else {
$Pseudo = htmlentities($_POST['pseudo'], ENT_QUOTES, "ISO-8859-1");
$MotDePasse = htmlentities($_POST['mdp'], ENT_QUOTES, "ISO-8859-1");
$mysqli = mysqli_connect("localhost", "becode", "becodepass", "COGIP");
if(!$mysqli){
echo "Erreur de connexion à la base de données.";
} else {
$Requete = mysqli_query($mysqli,"SELECT * FROM connexion WHERE username = '".$Pseudo."' AND pass = '".$MotDePasse."'");
if(mysqli_num_rows($Requete) == 0) {
echo "Le pseudo ou le mot de passe est incorrect, le compte n'a pas été trouvé.";
} else {
$_SESSION['pseudo'] = $Pseudo;
header("location:pages/main.php");
}
}
}
}
}
?>