-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
198 lines (109 loc) · 3.63 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Rock Note</title>
<link rel="stylesheet" href="styles/grid.css">
<link rel="stylesheet" href="styles/styles.css">
<link rel="icon" href="ressources/menu/Notepad_Pencil_clip_art_hight.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@100&display=swap" rel="stylesheet">
</head>
<body>
<?php
include 'php/sql.php';
include 'php/menu.php';
ConnectDatabase();
$loginStatus=CheckLogin();
?>
<div class="parenttitre">
<div class="titre">
<?php
if (isset($username)){
echo "<h1 class='centre'>Bienvenue $username.</h1> <h2 class='centre'> Quoi de neuf aujourd'hui ?</h2>";
}
else{
echo '<h1 class="centre">Bienvenu sur Rock Note</h1>';
}
?>
</div>
<div class="s_menu">
<?php
if (isset($username)){
if ( ! isset($_POST["newPost"]) && $_POST["newPost"] != 1 ) {
include('php/ajouter_post.php');
}
include "php/ecrire.php";
include "php/mettre_post_BDD.php";
}
else{
echo '<div class="centre"><a href="connexion.php">Connectez-vous >></a></div>';
}
?>
</div>
<div class="recherche">
<?php
include "recherche.php";
echo $message_recherche;
?>
</div>
</div>
<div class="parentcorps">
<div class="m_user">
<h3>Visitez d'autres pages Rock Note : </h3>
<?php
include ("php/sql_affichage_user.php");
?>
</div>
<div class="corps">
<?php
/*Pour avoir le userID*/
if (isset($username) ) {
$query10 = "SELECT `ID` FROM `connexion` WHERE logname = '" . $username . "' ";
$result10 = $conn->query($query10);
$userID = $result10->fetch_assoc()["ID"];
/*userAffiche la c'est egale à userID pour le test*/
$userAffiche = $_GET["userID"];
if ($userAffiche!="") {
$demande_nom = "SELECT `logname` FROM `connexion` WHERE ID = '" . $userAffiche . "' ";
$reponse_demande_nom = $conn->query($demande_nom);
$userAfficheNom = $reponse_demande_nom->fetch_assoc()["logname"];
echo "<h3 class='centre'>Vous regarder le bog de $userAfficheNom.</h3>";
}
else{
if(!isset($_POST["modifier"])){
echo "<h3 class='centre'>Cette utilisateur est inexistant donc :</h3>";
}
}
include "php/afficher_post.php";
if (!isset($_POST["modifier"])) {
DisplayPostsPage($userAffiche, $userID);
}
if (isset($_POST["modifier"])){
include "php/modification_post.php";
include "php/mettre_post_BDD.php";
}
}
else{
$userAffiche = $_GET["userID"];
if ($userAffiche!="") {
$demande_nom = "SELECT `logname` FROM `connexion` WHERE ID = '" . $userAffiche . "' ";
$reponse_demande_nom = $conn->query($demande_nom);
$userAfficheNom = $reponse_demande_nom->fetch_assoc()["logname"];
echo "<h3 class='centre'>Vous regarder le bog de $userAfficheNom.</h3>";
include "php/afficher_post.php";
DisplayPostsPage($_GET["userID"], -1);
}
else{
echo '<h3 class="centre">Recherchez vos amis !!</h3>';
}
}
?>
</div>
</div>
<?php
include 'php/footer.php';
DisconnectDatabase();
?>
</body>