-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpredictions.php
211 lines (204 loc) · 10.1 KB
/
predictions.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
<?php
session_start();
if (!isset($_SESSION['login'])) {
header('Location: index.php');
exit();
}
?>
<html>
<head>
<title>Les matchs | Pronostics coupe du monde 2018</title>
<link href='https://fonts.googleapis.com/css?family=Mina'
rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans'
rel='stylesheet'>
<link href='style.css' rel='stylesheet' type='text/css'>
<style>
#matchs tr {
padding: 0px;
}
#matchs td {
height: 100%;
padding: 0px;
overflow: hidden;
}
#matchs a {
margin: -1em;
padding: 1em;
display: block;
text-decoration: none;
color: black;
}
#matchs a:hover {
background: rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body>
<div align="left">
<font style="font-family: 'Mina'; font-size: 20px;"><a href="index.php"><b>PRONOSTICS COUPE DU MONDE 2018</b></a></font>
</div>
<div align="right">
<font style="font-size: 20px;"><a href="logout.php">Déconnexion</a></font>
</div><br/>
<div align="center">
<?php
include('connect.php');
?>
<font style="font-size: 30px;"><b><i>« Là où on va on n'a pas besoin... de route »</i></b><br/><br/></font>
</div>
<table width="100%" align="center">
<tr>
<td width="20%" align="center">
<font style="font-size: 15px;"><b>Matchs individuels</b></font><br/><br/>
</td>
<td width="20%" align="center">
<font style="font-size: 15px;"><a href="groupes.php">Toute la compétition</a></font><br/><br/>
</td>
<td width="20%" align="center">
<font style="font-size: 15px;"><a href="divers.php">Paris divers</a></font><br/><br/>
</td>
</tr>
</table>
<table width="90%" align="center">
<tr>
<td width="100%" align="left">
<font style="font-size: 25px;">Les matchs à venir</font><br/><br/>
<font style="font-size: 15px;">Ne s'affichent ici que les rencontres dont l'affiche est complètement connue. Les matchs de phase finale apparaîtront donc au fur et à mesure de l'avancée de la compétition.</font><br/><br/>
<font color="red" style="font-size: 20px;"><b>/!\ Vous pouvez désormais voir les pronostics des autres joueurs à l'issue des rencontres en cliquant sur les matchs passés /!\</b></font><br/><br/>
<font style="font-size: 15px; background: yellow"> MATCH AUJOURD'HUI </font>
<font style="font-size: 15px; background: grey"> PRONOSTIC EXPRIMÉ </font>
<font style="font-size: 15px; background: white"> EN ATTENTE DE VOTRE OPINION </font><br/><br/>
</td>
</tr>
</table>
<table width="90%" align="center" style="border-spacing: 10px;" id="matchs">
<?php
$req = $bdd->query("SELECT matchs.id AS id_match, DATE_FORMAT(date + INTERVAL '2' HOUR, '%d/%m, %Hh%i') AS dt, DATE_FORMAT(date + INTERVAL '2' HOUR, '%Y-%m-%d') AS day, matchs.groupe, eq1.pays AS e1, eq2.pays AS e2 FROM matchs JOIN teams eq1 ON eq1.id = matchs.team1 JOIN teams eq2 ON eq2.id = matchs.team2 WHERE date > NOW() AND played = 0 ORDER BY date ASC");
$i = 0;
while ($item = $req->fetch()) {
$pari = $bdd->prepare("SELECT score1, score2, winner FROM paris_match JOIN users ON users.id = paris_match.id_user WHERE id_match=:play AND users.login=:usr");
$pari->execute(array('play' => $item['id_match'], 'usr' => $_SESSION['login']));
$res = $pari->fetch();
if ($i % 4 == 0) {?>
<tr>
<?php
}?>
<td width="20%" align="center" id="<?php echo $item['id_match'];?>" style="border: 1px solid black; <?php echo 'background-color: ' . (date("Y-m-d") == $item['day']? 'yellow;': (!$res? 'white;': 'grey;')) ?>"><a href=<?php echo "match.php?id=" . $item['id_match']; ?>><div><br/>
<font style="font-size: 20px;"><?php echo $item['e1'] . ' — ' . $item['e2'];?></font><br/>
<font style="font-size: 15px;">-- / --</font><br/>
<font style="font-size: 15px;"><?php echo $item['dt'];?></font><br/>
<font style="font-size: 15px;"><b>
<?php
if ($_SESSION['login'] == 'admin') {
echo 'LE MATCH N\'EST PAS ENCORE PASSÉ';
} else {
if (!$res) {
echo 'AUCUN PARI POUR L\'INSTANT';
} else {
echo 'VOUS PRÉVOYEZ : ' . ($res['winner']==1?'[':'') . $res['score1'] . ($res['winner']==1?']':'') . '-' . ($res['winner']==2?'[':'') . $res['score2'] . ($res['winner']==2?']':'');
}
}
?>
</b></font><br/><br/>
</div></a>
</td><?php
if ($i % 4 == 3) {?>
</tr>
<?php
}
$i += 1;
}
?>
</table>
<table table width="90%" align="center">
<tr>
<td width="100%" align="left">
<font style="font-size: 25px;">Les matchs en attente du résultat</font><br/><br/>
</td>
</tr>
</table>
<table width="90%" align="center" style="border-spacing: 10px;" id="matchs">
<?php
$req = $bdd->query("SELECT matchs.id AS id_match, DATE_FORMAT(date + INTERVAL '2' HOUR, '%d/%m, %Hh%i') AS dt, matchs.groupe, eq1.pays AS e1, eq2.pays AS e2 FROM matchs JOIN teams eq1 ON eq1.id = matchs.team1 JOIN teams eq2 ON eq2.id = matchs.team2 WHERE date < NOW() AND played = 0 ORDER BY date ASC");
$i = 0;
while ($item = $req->fetch()) {
$pari = $bdd->prepare("SELECT score1, score2, winner FROM paris_match JOIN users ON users.id = paris_match.id_user WHERE id_match=:play AND users.login=:usr");
$pari->execute(array('play' => $item['id_match'], 'usr' => $_SESSION['login']));
$res = $pari->fetch();
if ($i % 4 == 0) {?>
<tr>
<?php
}?>
<td width="20%" align="center" style="border: 1px solid black;"><br/>
<font style="font-size: 20px;"><?php echo $item['e1'] . ' — ' . $item['e2'];?></font><br/>
<font style="font-size: 15px;">-- / --</font><br/>
<font style="font-size: 15px;"><?php echo $item['dt'];?></font><br/>
<font style="font-size: 15px;"><b>
<?php
if ($_SESSION['login'] == 'admin') {
echo '<a href="match.php?id=' . $item['id_match'] . '">RENSEIGNER LE RÉSULTAT DU MATCH</a>';
} else {
if (!$res) {
echo 'TROP TARD POUR PARIER';
} else {
echo 'VOUS PRÉVOYEZ : ' . ($res['winner']==1?'[':'') . $res['score1'] . ($res['winner']==1?']':'') . '-' . ($res['winner']==2?'[':'') . $res['score2'] . ($res['winner']==2?']':'');
}
}
?>
</b></font><br/><br/>
</td><?php
if ($i % 4 == 3) {?>
</tr>
<?php
}
$i += 1;
}
?>
</table>
<table width="90%" align="center">
<tr>
<td width="20%" align="left">
<font style="font-size: 25px;">Les matchs passés</font><br/><br/>
</td>
</tr>
</table>
<table width="90%" align="center" style="border-spacing: 10px;" id="matchs">
<?php
$req = $bdd->query("SELECT matchs.id AS id_match, DATE_FORMAT(date + INTERVAL '2' HOUR, '%d/%m, %Hh%i') AS dt, matchs.groupe, eq1.pays AS e1, eq2.pays AS e2, score1, score2, winner FROM matchs JOIN teams eq1 ON eq1.id = matchs.team1 JOIN teams eq2 ON eq2.id = matchs.team2 WHERE played = 1 ORDER BY date ASC");
$i = 0;
while ($item = $req->fetch()) {
$pari = $bdd->prepare("SELECT score1, score2 FROM paris_match JOIN users ON users.id = paris_match.id_user WHERE id_match=:play AND users.login=:usr");
$pari->execute(array('play' => $item['id_match'], 'usr' => $_SESSION['login']));
$res = $pari->fetch();
if ($i % 4 == 0) {?>
<tr>
<?php
}?>
<td width="20%" align="center" style="border: 1px solid black;" id="<?php echo $item['id_match'];?>">
<a href=<?php echo "match_result.php?id=" . $item['id_match']; ?>>
<br/>
<font style="font-size: 20px;"><?php echo $item['e1'] . ' — ' . $item['e2'];?></font><br/>
<font style="font-size: 15px;"><b><?php echo ($item['winner']==1?'[':'') . $item['score1'] . ($item['winner']==1?']':'') . ' / ' . ($item['winner']==2?'[':'') . $item['score2'] . ($item['winner']==2?']':'');?></b></font><br/>
<font style="font-size: 15px;"><?php echo $item['dt'];?></font><br/>
<font style="font-size: 15px;">
<?php
if (!$res) {
echo 'VOUS N\'AVIEZ PAS PARIÉ';
} else {
echo 'VOUS PRÉVOYIEZ : ' . ($res['winner']==1?'[':'') . $res['score1'] . ($res['winner']==1?']':'') . '-' . ($res['winner']==2?'[':'') . $res['score2'] . ($res['winner']==2?']':'');
}
?>
</font><br/><br/>
</a>
</td><?php
if ($i % 4 == 3) {?>
</tr>
<?php
}
$i += 1;
}
?>
</table>
</body>
</html>