-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplayrace.php
More file actions
124 lines (90 loc) · 4.44 KB
/
displayrace.php
File metadata and controls
124 lines (90 loc) · 4.44 KB
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
<?php
session_start();
$ip_bloquee = '172.16.1.10';
$ip_visiteur = $_SERVER['REMOTE_ADDR'];
if ($ip_visiteur === $ip_bloquee) {
http_response_code(403);
die('Accès refusé <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSjntChKonvOPTkzFMrAye40ok7QcLUBexP_g&s" alt="">');
}
include_once './db/variables.php';
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="keywords" content="Course, Running">
<meta name="description" content="Devenez adhérents à des courses à pied">
<meta name="author" content="QUEIROZ Florian">
<meta name="viewport" content="width=device-width">
<title>Club de course à pied</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/pages/displayRace.css">
<link rel="shortcut icon" href="../media/favicon.png" type="image/x-icon">
</head>
<body>
<?php
include './components/header.php';
?>
<section>
<div class="div-race-flex-container">
<div class="div-races-list">
<?php
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM course ORDER BY cou_date DESC LIMIT 100");
$stmt->execute();
$resultats = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($resultats) {
foreach ($resultats as $result){
?>
<a class="div-event-race" href="viewrace.php?id=<?php echo $result['cou_id']; ?>">
<img src="media/montagne.png" alt="Montagne">
<p><?php echo $result['cou_ville']; ?></p>
<div class="div-race-info">
<h4> <?php echo $result['cou_nom']; ?></h4>
<h3><?php echo $result['cou_date']; ?> à <span>9h30</span></h3>
<h5> <?php echo $result['cou_distance']; ?>km</h5>
</div>
</a>
<?php
}
}else {
$message ="error";
}
}
catch (PDOException $e) {
$message = "Echec de l'affichage :" . $e->getMessage();
}
if (!empty($message)){
echo $message;
}
?>
</div>
<div class="div-filter-list">
<div class="div-input-search">
<input type="text" name="" id="input-text-search" placeholder="Rechercher une course">
<button id="btn-submit-search"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path d="M21.0002 21L16.7002 16.7M19 11C19 15.4183 15.4183 19 11 19C6.58172 19 3 15.4183 3 11C3 6.58172 6.58172 3 11 3C15.4183 3 19 6.58172 19 11Z" stroke-linecap="round" stroke-linejoin="round"/>
</svg></button>
</div>
<?php
if (!empty($_SESSION['user'])){
if ($_SESSION['user']['admin'] == '1'){
?>
<a href="/ajouterCourse.php">
<button class="button-add-race">Ajouter une course</button>
</a>
<?php
}
}
?>
</div>
</div>
</section>
<script src="./js/searchs/searchRaces.js"></script>
<?php
include './components/footer.php';
?>
</body>
</html>