-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
94 lines (77 loc) · 3.2 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
session_start();
require_once __DIR__ . "/vendor/autoload.php";
try{
$frontController = new Project\Controllers\front\FrontController();
if(isset ($_GET["action"])){
if($_GET["action"] == "pizzas"){
$frontController->pizzas();
}
else if($_GET["action"] == "accueil"){
$frontController->accueil();
}
else if($_GET["action"] == "veg"){
$isVeg = $_GET["isVeg"];
$frontController->veg($isVeg);
}
else if($_GET["action"] == "pigless"){
$isPigless = $_GET["isPigless"];
$frontController->pigless($isPigless);
}
else if($_GET["action"] == "burger"){
$frontController->burger();
}
else if($_GET["action"] == "boissons"){
$frontController->boissons();
}
else if($_GET["action"] == "alcool"){
$isAlcool = $_GET["isAlcool"];
$frontController->alcool($isAlcool);
}
else if($_GET["action"] == "contact"){
$frontController->contact();
}
else if($_GET["action"] == "toto"){
$frontController->toto();
}
else if($_GET["action"] == "inscription"){
$userName = htmlspecialchars($_POST["userName"]);
$userFirstname = htmlspecialchars($_POST["userFirstname"]);
$userAdress = htmlspecialchars($_POST["userAdress"]);
$userPhone = htmlspecialchars($_POST["userPhone"]);
$userMail = htmlspecialchars($_POST["userMail"]);
$user1 = htmlspecialchars($_POST["userPWD"]);
$userPWD = password_hash($user1, PASSWORD_DEFAULT);
$frontController->inscription($userName, $userFirstname, $userAdress,$userPhone,$userMail, $userPWD);
}
else if($_GET["action"] == "contactMail"){
$lastname = htmlspecialchars($_POST["name"]);
$mail = htmlspecialchars($_POST["mail"]);
$sujet = htmlspecialchars($_POST["sujet"]);
$content = htmlspecialchars($_POST["content"]);
$frontController->contactMail($lastname, $mail, $sujet, $content);
}
else if($_GET["action"] == 'connexionAdmin'){
$pseudo = htmlspecialchars($_POST["pseudo"]);
$mdp = htmlspecialchars($_POST["pwd"]);
if(!empty($pseudo) && !empty($mdp)){
$frontController->connexionAdmin($pseudo, $mdp);
}else{
$frontController->erreurChampsVides();
}
}
else if($_GET["action"] == 'connexionUser'){
$userName = htmlspecialchars($_POST["pseudoUser"]);
$userPWD = htmlspecialchars($_POST["pwdUser"]);
if(!empty($userName) && !empty($userPWD)){
$frontController->connexionUser($userName, $userPWD);
}else{
$frontController->erreurChampsVides();
}
}
}else{
$frontController->accueil();
}
}catch(Exception $e){
die("Erreur:" . $e->getMessage());
};