-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
105 lines (104 loc) · 4.74 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
95
96
97
98
99
100
101
102
103
104
105
<?php
require_once('fonctions/fonctions.php');
try {
if (isset($_POST['deconnexion'])) {
deconnexion();
}
elseif (isset($_SESSION['nom']) && isset($_SESSION['prenom']) && isset($_SESSION['user_id'])) {
if (isset($_GET['page'])) {
if ($_GET['page'] == 'deconnexion') {
deconnexion();
}
elseif ($_GET['page'] == 'mentionslegales') {
mentionslegales();
}
elseif ($_GET['page'] == 'contact') {
contact();
}
elseif ($_GET['page'] == 'parametrescompte') {
paramCompte($_SESSION['user_id']);
}
elseif (($_GET['page'] == 'acteur') && (isset($_GET['acteurid']))) {
if (isset($_POST['commentaire'])) {
postCommentaire($_GET['acteurid'], $_SESSION['user_id'], htmlspecialchars($_POST['commentaire']));
}
elseif (isset($_POST['like'])) {
postLike($_GET['acteurid'], $_SESSION['user_id']);
}
elseif (isset($_POST['dislike'])) {
postDislike($_GET['acteurid'], $_SESSION['user_id']);
}
acteur($_GET['acteurid'], $_SESSION['user_id']);
}
elseif ($_GET['page'] == 'paramcompte') {
if (isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['user_name'])) {
modifierIdentite(htmlspecialchars($_POST['nom']), htmlspecialchars($_POST['prenom']), htmlspecialchars($_POST['user_name']), $_SESSION['user_id']);
}
elseif (isset($_POST['mdp']) && isset($_POST['confirm_mdp'])) {
modifierMotDePasse(htmlspecialchars($_POST['mdp']), htmlspecialchars($_POST['confirm_mdp']), $_SESSION['user_id']);
}
elseif (isset($_POST['question']) && isset($_POST['reponse'])) {
modifierQuestionReponse(htmlspecialchars($_POST['question']), htmlspecialchars($_POST['reponse']), $_SESSION['user_id']);
}
else {
paramCompte($_SESSION['user_id']);
}
}
else {
pageNonTrouvee();
}
}
else {
pageActeurs();
}
}
elseif (isset($_GET['page'])) {
if ($_GET['page'] == 'inscription') {
if (isset($_POST['nom']) && ($_POST['prenom']) && ($_POST['userName']) && ($_POST['mdp']) && ($_POST['confirmMdp']) && ($_POST['questionSecrete']) && ($_POST['reponseSecrete'])) {
nouvelUtilisateur(htmlspecialchars($_POST['nom']), htmlspecialchars($_POST['prenom']), htmlspecialchars($_POST['userName']), htmlspecialchars($_POST['mdp']), htmlspecialchars($_POST['confirmMdp']), htmlspecialchars($_POST['questionSecrete']), htmlspecialchars($_POST['reponseSecrete']));
pageActeurs();
}
else {
inscription();
}
}
elseif ($_GET['page'] == 'oublimdp') {
if (isset($_POST['userNameMdpReset'])) {
reinitMdpQuestion(htmlspecialchars($_POST['userNameMdpReset']));
}
elseif (isset($_POST['reponseMdpReset'])) {
reinitMdpReponse($_SESSION["userName"],htmlspecialchars($_POST['reponseMdpReset']));
}
elseif ((isset($_POST['nouveauMdp'])) && (isset($_POST['confirmNouveauMdp']))) {
reinitMdpNouveauMdp($_SESSION["userName"], htmlspecialchars($_POST['nouveauMdp']), htmlspecialchars($_POST['confirmNouveauMdp']));
}
else {
reinitMdp();
}
}
elseif ($_GET['page'] == 'mentionslegales') {
mentionslegales();
}
elseif ($_GET['page'] == 'contact') {
contact();
}
else {
pageNonTrouvee();
}
}
elseif (isset($_POST['nom']) && ($_POST['prenom']) && ($_POST['userName']) && ($_POST['mdp']) && ($_POST['confirmMdp']) && ($_POST['questionSecrete']) && ($_POST['reponseSecrete'])) {
nouvelUtilisateur(htmlspecialchars($_POST['nom']), htmlspecialchars($_POST['prenom']), htmlspecialchars($_POST['userName']), htmlspecialchars($_POST['mdp']), htmlspecialchars($_POST['confirmMdp']), htmlspecialchars($_POST['questionSecrete']), htmlspecialchars($_POST['reponseSecrete']));
pageActeurs();
}
elseif ((isset($_POST['identifiant'])) && (isset($_POST['motDePasse']))) {
connexion(htmlspecialchars($_POST['identifiant']), htmlspecialchars($_POST['motDePasse']));
pageActeurs();
}
else {
pageConnexion();
}
}
catch(Exception $e) {
$errorMessage = $e->getMessage();
require('view/errorView.php');
}