-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
53 lines (40 loc) · 1.81 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
<?php
use App\InvalidToken;
require_once 'layout/header.php';
require_once 'db/pdo.php';
require_once 'functions/functions.php';
$session->unknownUser();
$userId = $_SESSION['user_id'];
$stmtDisplay = $pdo->query("SELECT * FROM game WHERE id_users = $userId;");
$results = $stmtDisplay->fetchAll();
?>
<h1 id="app" class="col-md-12 text-center text-black display-5 py-5"></h1>
<?php
if(array_key_exists('error',$_GET)) { ?>
<div class="alert alert-danger text-center col-md-3 mx-auto p-3">
<p class="m-0"><?php echo InvalidToken::getErrorMessage(intval($_GET['error']))?></p>
</div>
<?php } ?>
<section class="container">
<form class="row justify-content-center gap-3 my-5" action="results.php" method="GET">
<input class="w-50 rounded-3 search form-control" placeholder="🔍 Search" type="text" name="q" value="<?php echo $_GET['q'] ?? ''; ?>">
<select class="w-25 rounded-3 form-control" name= "category">
<option selected>All categories</option>
<option value="1">RPG</option>
<option value="2">Action</option>
<option value="3">Sport</option>
</select>
<button type="submit" class="btn btn-dark col-md-1 rounded-3">Search</button>
</form>
</section>
<div class="container">
<div class="row justify-content-center gap-3">
<?php foreach ($results as $game) { ?>
<div class="col-md-2 text-center vignette">
<h2 class="h6 bg-dark text-light mb-0 rounded-top-3 py-2"><?php echo excerpt($game['name_game'] ,10); ?></h2>
<a href="gameInfo.php?id=<?php echo $game['id_game']?>"><img class="img-fluid rounded-bottom-3" src="<?php echo $game['picture_game']; ?>"></a>
</div>
<?php } ?>
</div>
</div>
<?php require_once 'layout/footer.php';?>