-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
79 lines (63 loc) · 2.36 KB
/
index.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
<?php
session_start();
try
{
$bdd = new PDO("mysql:host=localhost;dbname=my.bocuse;charset=utf8", "root", "", [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./style.css" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300&display=swap" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.12.0/css/all.css" rel="stylesheet">
<link rel="icon" href="./favicon.ico" type="image/png" />
<title>My.Bocuse</title>
</head>
<body>
<?php
if(isset($_POST['email'])&& isset($_POST['pwd'])){
$request = $bdd->prepare('SELECT id,email ,pass, first_name,last_name,statut FROM mybocuse WHERE email=?');
$request->execute([
strip_tags(trim($_POST['email'])),
]);
$data = $request ->fetch();
if($data['pass'] === sha1($_POST['pwd'])){
$_SESSION['id'] = $data['id'];
$_SESSION['email'] = $data['email'];
$_SESSION['pass'] = $data['pass'];
$_SESSION['prenom'] = $data['first_name'];
$_SESSION['nom'] = $data['last_name'];
$_SESSION['statut'] = $data['statut'];
}
else if(['pass'])
$request->closeCursor();
}
if(!empty($_SESSION)){
include('./Files_proteges/header_login_page.php');
if($_SESSION['statut'] === 'Chef' || $_SESSION['statut'] === 'Learner'){
include('./Files_proteges/login_page.php');
}
else{
echo '<div class="div_statut"><p class="no_status">No status has been assigned to you...</br>
Please disconnect and ask the chefs to assign you a status !!!</p></div>';
}
}
else {
// Header
include('./Files_proteges/header_formulaire.php');
// Main
include('./Files_proteges/formulaire.php');
}
include('./Files_proteges/footer.php')
?>
</body>
<script src="script.js"></script>
</html>