-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrandom.php
54 lines (48 loc) · 1.16 KB
/
random.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
<?php
include 'dbreq.php';
//requête du droit de l'user
$droit = $bdd->prepare("SELECT * FROM user WHERE pseudo = ?");
$droit->execute(array($_SESSION['pseudo']));
$droituser = $droit-> fetch();
// 12 random games
$req = $bdd->query('SELECT * FROM games ORDER BY RAND() LIMIT 12');
?>
<?php
include 'intro.php';
include 'menu.php';
// if ($droituser['droit']=="premium" || $droituser['droit']=="admin"){
// include 'chat.php';
// }
?>
<div class="container-fluid">
<div class="row">
<?php
while ($donnees = $req->fetch())
{
?>
<div class="col-sm-12 col-md-6 col-lg-4 col-xl-3 text-center">
<a href='jeu.php?id=<?php //add id to get the rigth jeu.php
echo htmlspecialchars($donnees['id']);
?>'>
<img class= "m-2 border border-white rounded-lg" src="
<?php
//img from db
echo htmlspecialchars('data:image/jpeg;base64,'.base64_encode( $donnees['cover'] ));
?>
" alt="
<?php
//nom from db
echo htmlspecialchars($donnees['nom']);
?>
"></a>
</div>
<?php
}
// end while for comment
$req->closeCursor();
?>
</div>
</div>
<?php
include 'outro.php';
?>