-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpronosticos.php
179 lines (168 loc) · 6.59 KB
/
pronosticos.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
<?php
include 'conf/db.php';
include_once 'includes/db_connect.php';
include_once 'includes/functions.php';
sec_session_start();
?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Champions League 2015</title>
<style>
th {
text-align: center !important;
}
td {
line-height: 35px !important;
vertical-align: middle !important;
text-align: center !important;
}
.panel-heading img {
width: 35px;
}
tr {
text-align: center;
}
</style>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Champions League 2015</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/">Inicio</a></li>
<li><a href="/partidos.php">Partidos</a></li>
<li class="active"><a href="/pronosticos.php">Pronósticos</a></li>
<li><a href="/tabla.php">Tabla</a></li>
<li style="float:right;"><?php if (login_check($mysqli) == true) {
echo "<a href='includes/logout.php' >Salir</a>";
} ?>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav><br><br><br><br>
<div class="container" style="max-width: 700px;">
<div class="starter-template">
<?php if (login_check($mysqli) == true) : ?>
<?php
$i = 0;
$sql = "SELECT partidos.id,
equipos.nombre AS local,
equipos.logo AS logo_local,
equipos_1.nombre AS visitante,
equipos_1.logo AS logo_visitante,
partidos.goles_local,
partidos.goles_visitante,
DATE_SUB(partidos.fecha, INTERVAL 1 HOUR),
DATE_ADD(NOW(), INTERVAL -1 HOUR)
FROM (admin_shampions.partidos partidos
INNER JOIN admin_shampions.equipos equipos_1
ON (partidos.visitante = equipos_1.id))
INNER JOIN admin_shampions.equipos equipos
ON (partidos.local = equipos.id)
WHERE (partidos.fecha BETWEEN DATE_SUB(partidos.fecha, INTERVAL 1 HOUR) AND DATE_ADD(NOW(), INTERVAL 0 HOUR))
ORDER BY partidos.id DESC";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result))
{
$i++;
echo "
<div class='panel panel-primary' style='max-width: 600px; margin: 0 auto;'>
<div class='panel-heading'>".
$row['local'].
"<img src='" . $row['logo_local'] . "''>
vs
<img src='" . $row['logo_visitante'] . "'>".
$row['visitante'] .
" <strong style='font-size: x-large;
vertical-align: middle;
float: right;'> ".
$row['goles_local'] .
" - " .
$row['goles_visitante'] .
"</strong></div>
<table class='table'>
<thead><tr>
<th>Nombre</th>
<th>Local</th>
<th>Visitante</th>
<th>Puntos</th>
</tr></thead>
<tbody>";
// DATOS AQUÍ
$partido = $row['id'];
$query_pronosticos = "SELECT DISTINCT
pronosticos.id_partido,
usuarios.nombre,
pronosticos.goles_local,
pronosticos.goles_visitante,
IF(pts_partido.pts_marcador = 'ok', '1', '0')
* valor_puntos.pts_marcador
+ IF(pts_partido.pts_resultado = 'ok', '1', '0')
* valor_puntos.pts_resultado
AS puntos
FROM (((admin_shampions.pronosticos pronosticos
INNER JOIN admin_shampions.pts_partido pts_partido
ON (pronosticos.id_usuario = pts_partido.id_usuario))
INNER JOIN admin_shampions.usuarios usuarios
ON (pronosticos.id_usuario = usuarios.id))
INNER JOIN admin_shampions.partidos partidos
ON (partidos.id = pts_partido.id_partido))
INNER JOIN admin_shampions.valor_puntos valor_puntos
ON (valor_puntos.ronda = partidos.ronda)
WHERE pronosticos.id_partido = '$partido' AND pts_partido.id_partido = '$partido'
GROUP BY usuarios.nombre
ORDER BY puntos DESC";
$resultado_pronosticos = mysqli_query($conn, $query_pronosticos);
while($linea = mysqli_fetch_array($resultado_pronosticos))
{echo "<tr>
<td>" . $linea['nombre'] . "</td>
<td>" . $linea['goles_local'] . "</td>
<td>" . $linea['goles_visitante'] . "</td>
<td>" . $linea['puntos'] . "</td>
</tr>";};
// FIN DATOS
echo "
</tbody>
</table>
</div>
<br>
";
};
} else {
echo "<br>Sin Resultados";
};
//$conn->close(); // Cerrar DB
?>
<?php else : ?>
<p>
<?php include 'includes/mensaje_no_autorizado.php'; ?>
</p>
<?php endif; ?>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</body>