-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
372 lines (319 loc) · 10.7 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<?php//1904802?>
<?php include('functions.php') ?>
<html>
<head>
<title>Roasted Games</title>
<link rel="stylesheet" type="text/css" href="style1.css">
<link href="https://fonts.googleapis.com/css2?family=Jura:wght@500&display=swap" rel="stylesheet">
</head>
<body>
<a href="admin.php" style="text-decoration: none">
<div class="top_header">
<p id="title">ROASTED GAMES</p>
</div>
</a>
<div class="ciao">
<div class="spacetaker">
</div>
<div class="top_nav">
<a href="admin.php">GAME LIST</a>
<a href="login.php" class="aNav">LOG IN</a>
<a href="register.php" class="aNav">REGISTER</a>
<div class="searchbar">
<form action="" method="post">
<input type="text" name="search" placeholder="Search titles..."></a>
</form>
</div>
</div>
</div>
<!--
<div class="banner">
<img src="assets/img/background/tiger.jpg">
</div>
-->
<div class="bestgameheader">
<h2 style="flex-grow: 1.3">BEST RATED GAME</h2>
<h2 style="flex-grow: 1">FOLLOW UPS</h2>
</div>
<div class="topbox">
<div class="slideshow" style="flex-grow: 5">
<?php
global $db, $username, $errors;
$query = "SELECT title, image, rating, id FROM games ORDER BY rating DESC LIMIT 1";
$results = mysqli_query($db, $query);
$results = mysqli_fetch_assoc($results);
$gameTitle = $results["title"];
$file = $results["image"];
$gameRating = $results["rating"];
$gameId = $results["id"];
echo $title;
echo $rating;
echo $img;
echo "<div class=\"slideshow\">
<a href='game.php?id=$gameId'>
<img src=\"$file\" alt=\"error\" class=\"game_img\">
</a>
</div>";
?>
</div>
<div class="topgames" style="flex-grow: 1">
<?php
global $db, $username, $errors;
$query = "SELECT title, image, rating, id FROM games ORDER BY rating DESC LIMIT 6 OFFSET 1";
$results = mysqli_query($db, $query);
foreach($results as $game){
$gameTitle = $game["title"];
$file = $game["image"];
$gameRating = $game["rating"];
$gameId = $game["id"];
echo "<div class=\"topgame\">";
echo "<a href='game.php?id=$gameId'>";
echo "<img src=\"$file\">";
echo "</a>";
echo "<div class=\"gameinfo\">";
echo $gameTitle . "<br>";
echo "Rating: " . '<strong>'.$gameRating.'</strong>';
echo "</div>";
echo "</div>";
}
?>
<!--
<div class="topgame">
<img src="assets/img/games/Sid Meiers Civilization V Brave New World.jfif">
<div class="gameinfo">
<p>GAME 1 X Reviews</p>
</div>
</div>
<div class="topgame">
<img src="assets/img/games/crusader kings 2.jpg">
<div class="gameinfo">
<p>GAME 1 X Reviews</p>
</div>
</div>
<div class="topgame">
<img src="assets/img/games/cover-else-heart.break.png">
<div class="gameinfo">
<p>GAME 1 X Reviews</p>
</div>
</div>
<div class="topgame">
<img src="assets/img/games/Train Simulator 2020.jfif">
<div class="gameinfo">
<p>GAME 1 X Reviews</p>
</div>
</div>
<div class="topgame">
<img src="assets/img/games/Shadowrun Hong Kong - Extended Edition.jpg">
<div class="gameinfo">
<p>GAME 1 X Reviews</p>
</div>
</div>
<div class="topgame">
<img src="assets/img/games/Cave Story+.jpg">
<div class="gameinfo">
<p>GAME 1 X Reviews</p>
</div>
</div>
-->
</div>
</div>
<div class="midheader">
<h2>GAME LIST</h2>
</div>
<div class="filters">
<form action="" method="get">
<select name = "order" onchange="this.form.submit()">
<option class="filters">Order By</option>
<option class="filters" type="submit" value="A-Z (A first)" name="sort">A-Z (A first)</option>
<option class="filters" type="submit" value="A-Z (Z first)" name="sort">A-Z (Z first)</option>
<option class="filters" type="submit" value="Rating (Best first)" name="sort">Rating (Best first)</option>
<option class="filters" type="submit" value="Rating (Worst first)" name="sort">Rating (Worst first)</option>
</select>
</form>
<form action="" method="get">
<select name ="order" onchange="this.form.submit()">
<option class="filters">Filter By Genre</option>
<option class="filters" type="submit" value="Rpg" name="sort">Role-Playing Game</option>
<option class="filters" type="submit" value="Sim" name="sort">Simulation Game</option>
<option class="filters" type="submit" value="Strategy" name="sort">Strategy</option>
<option class="filters" type="submit" value="FPS" name="sort">First Person Shooter</option>
<option class="filters" type="submit" value="???" name="sort">Other</option>
</select>
</form>
</div>
<div class="games_container" id="games">
<?php
global $db, $username, $errors;
$sort = $_GET["order"];
$search = e($_POST['search']);
if(!empty($search)){
$query = "SELECT * FROM games WHERE title LIKE '%".$search."%'";
}elseif($sort == "Rpg"){
$query = "SELECT * FROM games WHERE genre = 'rpg'";
}elseif($sort == "Sim"){
$query = "SELECT * FROM games WHERE genre = 'sim'";
}elseif($sort == "Strategy"){
$query = "SELECT * FROM games WHERE genre = 'str'";
}elseif($sort == "FPS"){
$query = "SELECT * FROM games WHERE genre = 'fps'";
}elseif($sort == "???"){
$query = "SELECT * FROM games WHERE genre = '???'";
}elseif($sort == "A-Z (A first)"){
$query = "SELECT * FROM games ORDER BY title";
}elseif($sort == "A-Z (Z first)"){
$query = "SELECT * FROM games ORDER BY title DESC";
}elseif($sort == "Rating (Best first)"){
$query = "SELECT * FROM games ORDER BY rating DESC";
}elseif($sort == "Rating (Worst first)"){
$query = "SELECT * FROM games ORDER BY rating ASC";
}else{
$query = "SELECT * FROM games";
}
$results = mysqli_query($db, $query);
$rows = mysqli_num_rows($results);
if (mysqli_num_rows($results) != 0){
while($row = mysqli_fetch_assoc($results)){
$games[] = $row;
}
$i = 0;
echo "<table>";
while($i < $rows){
$file = $games[$i]["image"];
$gameTitle = $games[$i]["title"];
$gameId = $games[$i]["id"];
$_SESSION["games"] = $games;
echo "<tr>";
echo "</tr>";
echo "<div class=\"game_box\">
<img src=\"$file\" alt=\"error\" class=\"game_img\">
<a href='game.php?id=$gameId'>
<div class=\"middle\">
<p class=\"text\">$gameTitle</p>
</div>
</a>
</div>";
$i++;
}
echo "</table>";
}else{
echo "<strong style='justify-self: center; font-size: 30px'>";
echo "No Results";
echo "</strong>";
}
?>
<!--
<div class="game_box">
<img src="assets/img/games/Sid Meiers Civilization V Brave New World.jfif" class="game_img">
<div class="middle">
<div class="text">Sid Meier's Civilization V: Brave New World</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/crusader kings 2.jpg" class="game_img">
<div class="middle">
<div class="text">Crusader Kings II</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Warcraft III Reforged.jfif" class="game_img">
<div class="middle">
<div class="text">Warcraft III: Reforged</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/cover-else-heart.break.png" class="game_img">
<div class="middle">
<div class="text">Else Heart.Break()</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Shadowrun Dragonfall - Directors Cut.png" class="game_img">
<div class="middle">
<div class="text">Shadowrun: Dragonfall - Director's Cut</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Stardew Valley.jfif" class="game_img">
<div class="middle">
<div class="text">Stardew Valley</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/disco-elysium-art-and-logo.jpeg" class="game_img">
<div class="middle">
<div class="text">Disco Elysium</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/RimWorld.jpg" class="game_img">
<div class="middle">
<div class="text">RimWorld</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Tom Clancys Rainbow Six Siege.jpg" class="game_img">
<div class="middle">
<div class="text">Tom Clancy's Rainbow Six Siege</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Euro Truck Simulator 2.jfif" class="game_img">
<div class="middle">
<div class="text">Euro Truck Simulator 2</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/farming-simulator-19-cover.jpg" class="game_img">
<div class="middle">
<div class="text">Farming Simulator 19</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Train Simulator 2020.jfif" class="game_img">
<div class="middle">
<div class="text">Train Simulator 2020</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Project Zomboid.jpg" class="game_img">
<div class="middle">
<div class="text">Project Zomboid</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Shadowrun Returns.jpg" class="game_img">
<div class="middle">
<div class="text">Shadowrun Returns</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Shadowrun Hong Kong - Extended Edition.jpg" class="game_img">
<div class="middle">
<div class="text">Shadowrun: Hong Kong - Extended Edition</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Cave Story+.jpg" class="game_img">
<div class="middle">
<div class="text">Cave Story+</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Sorcery! Parts 1 & 2.jpg" class="game_img">
<div class="middle">
<div class="text">Sorcery! Parts 1 & 2</div>
</div>
</div>
<div class="game_box">
<img src="assets/img/games/Dwarf Fortress.png" class="game_img">
<div class="middle">
<div class="text">Dwarf Fortress</div>
</div>
</div>
-->
</div>
<footer>
<h3>Copyright © 2020. All rights reserved.</h3>
</footer>
</body>
</html>