-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.php
86 lines (76 loc) · 2.98 KB
/
results.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="keywords" content="xhtml, html5, form" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>Résultats</title>
<script src ="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
<script type='text/javascript' src='js/results.js'></script>
<script type="text/javascript" src = "bootstrap/js/bootstrap.js"></script>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/flux.css">
</head>
<?php
$first_field = "Homme";
$second_field = "Femme";
$third_field = "Mixte";
$result_categorie = "Homme";
if(!empty($_POST["categorie"])){
$_SESSION['categorie'] = htmlspecialchars($_POST["categorie"]);
if($_SESSION["categorie"] == "Homme"){
$first_field = "Homme";
$second_field = "Femme";
$third_field = "Mixte";
} else if ($_SESSION["categorie"] == "Femme"){
$first_field = "Femme";
$second_field = "Homme";
$third_field = "Mixte";
} else {
$first_field = "Mixte";
$second_field = "Homme";
$third_field = "Femme";
}
$result_categorie = $_POST["categorie"];
}
?>
<form class="" action="" method="post" id = "filter">
<div class="container">
<div class = "form-group">
<?php
?>
<select class="form-control" name="categorie" type = "submit" onchange="submit('filter');" type = "submit">
<option value="<?= $first_field; ?>"><?= $first_field; ?></option>
<option value="<?= $second_field; ?>"><?= $second_field; ?></option>
<option value="<?= $third_field; ?>"><?= $third_field; ?></option>
</select>
</div>
</div>
</form>
<?php
require("database.php");
require("class/Image.php");
$find_girl = $bdd->prepare("SELECT * FROM photo WHERE Categorie = ? ORDER BY like_count DESC");
$find_girl->execute(array($result_categorie));
while($girl_classement = $find_girl->fetch()){
?>
<div class="container">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?= $girl_classement['Titre']; ?></h5>
<p class="card-text"><?= $girl_classement['Contenu']; ?></p>
<p class="card-text"><small>Auteur : <?= $girl_classement['Auteur']; ?></small></p>
</div>
<img src="<?= "img/database/".$girl_classement['Chemin']; ?>" class="card-img-top photo_actu" alt="image_displayed">
<div class="vote is_liked" >
<div class="vote_btns">
<p class = "card-title" style="margin-top:5vh;margin-bottom:5vh"><strong>Nombre de like : <?= $girl_classement['like_count']; ?></strong></p>
</div>
</div>
</div>
</div>
<br/>
<?php
}
?>