-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnexion.php
More file actions
49 lines (43 loc) · 1.49 KB
/
connexion.php
File metadata and controls
49 lines (43 loc) · 1.49 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
<?php
session_start();
if((isset($_SESSION['co'])) && $_SESSION['co'] === true)
header('location: index.php');
if(isset($_POST['envoi']) && $_POST['envoi'] == 1)
{
require('config.inc.php');
$pseudo = htmlspecialchars($_POST['pseudo'], ENT_QUOTES);
$mdp = hash('sha512', $_POST['mdp']);
$requete = mysql_query('SELECT * FROM '.$bdd_prefixe.'user WHERE pseudo = "'.$pseudo.'" AND mdp = "'.$mdp.'" AND valide = 1');
mysql_close();
if(!($requete === false) && $donnees = mysql_fetch_array($requete))
{
$_SESSION['pseudo'] = $donnees['pseudo'];
$_SESSION['id'] = $donnees['id'];
$_SESSION['co'] = true;
header('location: index.php');
} else
$erreur = "Pseudo et/ou mot de passe incorrect(s).";
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<title>Cotrainage</title>
<link rel="icon" type="image/png" href="images/favicon.png" />
<link rel="stylesheet" href="main.css" type="text/css" media="screen" />
</head>
<body>
<header>
<h1>Cotrainage</h1>
</header>
<?php if(isset($erreur)) { ?><p><?php echo $erreur; ?></p><?php } ?>
<form action="connexion.php" method="post"><p>
<label name="pseudo">Pseudo : <input name="pseudo" /></label><br />
<label name="mdp">Mot de passe : <input type="password" name="mdp" /></label><br />
<input type="hidden" name="envoi" value="1" />
<input type="submit" value="Valider" />
</p></form>
<p><a href="inscription.php">S'inscrire</a> - <a href="oubli_mdp.php">Mot de passe oublié ?</a></p>
</body>
</html>