-
Notifications
You must be signed in to change notification settings - Fork 1
/
connexion.php
110 lines (80 loc) · 2.58 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
session_start();
/*if (isset($_SESSION['nom']))
{
header('location:profile.php');
// taper ici ikik
}*/
include "inc/functions.php";
$user=true;
$categories = getAllCategorie();
if(!empty($_POST))
{
$user = ConnectVisiteur($_POST);
if( is_array($user) && count($user) > 0) // utilisateur connecté
{
Session_start();
$_SESSION['id'] = $user['id'] ;
$_SESSION['email'] = $user['email'] ;
$_SESSION['nom'] = $user['nom'] ;
$_SESSION['prenom'] = $user['prenom'] ;
$_SESSION['mp'] = $user['mp'] ;
$_SESSION['telephone'] = $user['telephone'] ;
$_SESSION['etat'] = $user['etat'] ;
header('location:profile.php'); // redirection vers la page profile
}
else
{
echo "no";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>E-SHOP</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<body>
<?php
include "inc/header.php";
?>
<!--fin navbar-->
<div class="col-12 p-5">
<h1 class="text-center">connexion</h1>
<form action="connexion.php" method="POST">
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Email address</label>
<input type="email" name="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
<div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Password</label>
<input type="password" name="mp" class="form-control" id="exampleInputPassword1">
</div>
<button type="submit" class="btn btn-primary">connecter</button>
</form>
</div>
<?php include "inc/footer.php"?>
</body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.4.8/sweetalert2.all.min.js"></script>
<?php
if(!$user)
{
print "
<script>
Swal.fire({
title: 'Erreur',
text: 'coordonés non valide',
icon: 'error',
confirmButtonText: 'ok'
})
</script>
";
}
?>
</html>