-
Notifications
You must be signed in to change notification settings - Fork 0
/
inicio.php
74 lines (67 loc) · 3.1 KB
/
inicio.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
<?php
include './header.php';
include_once './CRUD/CRUDUsuario.php';
include_once './CRUD/CRUDNoticia.php';
datosMiEquipo($_SESSION['equipoUser']);
if (isset($_SESSION['usuario_logueado']) && $_SESSION['usuario_logueado']) {
?>
<section class="generico2">
<table>
<tr>
<td>
<div id="perfil">
<a href="editarPerfil.php" class = "enlaceMensajes"><img src="<?php echo $_SESSION['foto_usuario_login']; ?>" alt="<?php echo $_SESSION['nombre_usuario_login']; ?>" height="150px"></a>
<div>Editar perfil</div>
</div>
</td>
<td><h1>Bienvenido <a href="editarPerfil.php" class = "enlaceMensajes"><?php echo $_SESSION['nombre_usuario_login'] . ' ' . $_SESSION['apellido1_usuario_login'] . ' ' . $_SESSION['apellido2_usuario_login']; ?></a></h1></td>
</tr>
</table>
<a href="editarPerfil.php"></a>
<article>
<div id="colNoticias1">
<table>
<tr>
<td>
<h1>Noticias del<em><?php echo " " . $_SESSION['nombre_equipo']; ?></em></h1>
</td>
<td>
<img src="<?php echo $_SESSION['foto_equipo']; ?>" alt="<?php echo $_SESSION['nombre_equipo']; ?>" height="35px">
</td>
</tr>
</table>
<?php
$con = conectaBD();
if (!isset($_GET['idNoticia'])) {
$sqlQuery = "SELECT * FROM noticia WHERE id_equipo= " . $_SESSION['equipoUser'] . " ORDER BY id_noticia DESC";
$result = mysqli_query($con, $sqlQuery);
//No hago bucle porque solo quiero mnostrar la última noticia
$col = mysqli_fetch_array($result);
echo '<strong>' . $col['fecha_noticia'] . '</strong>' . " <br><strong>" . $col['titular_noticia'] . '</strong><br>';
echo '<p class="pNoticia">' . $col['texto_noticia'] . '</p>';
} else {
$sqlQuery = "SELECT * FROM noticia WHERE id_noticia=" . $_GET['idNoticia'];
$result = mysqli_query($con, $sqlQuery);
//No hago bucle porque solo quiero mnostrar la última noticia
$col = mysqli_fetch_array($result);
echo '<strong>' . $col['fecha_noticia'] . '</strong>' . " <br><strong>" . $col['titular_noticia'] . '</strong><br>';
echo '<p class="pNoticia">' . $col['texto_noticia'] . '</p>';
}
mysqli_close($con);
?>
</div>
</article>
<article>
<div id="colNoticias2">
<h1>Titulares:</h1><p>Haz click para ver el contenido</p>
<?php
listaMisTitulares($_SESSION['equipoUser']);
?>
</div>
</article>
</section>
<?php
} else {
header('location: login.php');
}
include './footer.php';