-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconnect.php
44 lines (43 loc) · 1.41 KB
/
connect.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
<?php
include_once("./includes.php");
if(isset($_GET['action']))
{
switch($_GET['action'])
{
case "logout":
// SCRIPT DE DECONNEXION
entete("Deconnexion...");
$_SESSION = array();
echo "Vous etes deconnecte... Renvoi vers l'accueil.";
pied();
die('<meta http-equiv="refresh" content="2;URL=./index.php">');
break;
case "login":
entete("Connexion...");
if (empty($_POST['mail'])or empty($_POST['pass']))
{
echo "Vous avez oublie de remplir un champ";
die('<meta http-equiv="refresh" content="2;URL=./index.php">');
}
$req_connexion=query("select * from utilisateur where mail='".$_POST['mail']."'; ");
if(mysql_num_rows($req_connexion)==0)
{
echo "E_mail incorrect";
die('<meta http-equiv="refresh" content="2;URL=./index.php">');
}
$connexion=mysql_fetch_array($req_connexion);
if(($_POST['pass'])!=$connexion['password'])
{
echo "Mot de passe incorrect";
die('<meta http-equiv="refresh" content="2;URL=./index.php">');
}
$_SESSION['pseudo']=$connexion['pseudo'];
$_SESSION['idTypeUtil']=$connexion['id_TypeUtil'];
$_SESSION['idUtil']=$connexion['idUtil'];
echo "Connexion reussie... Renvoi vers l'accueil.";
pied();
die('<meta http-equiv="refresh" content="2;URL=./index.php">');
break;
}
}
?>