MVC juego.php

This commit is contained in:
2026-09-30 11:30:30 +02:00
parent 4f6e15863e
commit ed7067161a
3 changed files with 123 additions and 63 deletions
+27 -23
View File
@@ -1,22 +1,6 @@
<?php
session_start();
// Hay que estar logueado para jugar
if (!isset($_SESSION['idUsuario'])) {
header('Location: index.php');
exit;
}
// La partida llega por la URL: juego.php?idPartida=3
$idPartida = filter_input(INPUT_GET, 'idPartida', FILTER_VALIDATE_INT);
if (!$idPartida || $idPartida < 1) {
header('Location: buscadorSala.php');
exit;
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -24,28 +8,48 @@ if (!$idPartida || $idPartida < 1) {
<title>Proyecto Trivial</title>
<link rel="stylesheet" href="css/juego.css">
<link rel="icon" type="image/svg+xml" href="img/favicon/favicon.svg">
</head>
<body data-id-partida="<?= (int)$idPartida ?>">
<!-- Progreso: "Pregunta 3 de 10" + barra -->
<body>
<!-- CABECERA Y PROGRESO -->
<div class="game-header">
<span id="contadorPregunta">Cargando…</span>
<span id="contadorPregunta">
Cargando…
</span>
</div>
<div class="progress-track">
<div class="progress-fill" id="barraProgreso"></div>
</div>
<!-- Contenedor de la Pregunta (lo rellena js/juego.js) -->
<!-- PREGUNTA -->
<div class="question-container">
<div id="textoPregunta">Cargando preguntas…</div>
<div id="textoPregunta">
Cargando preguntas…
</div>
<div id="feedback" class="feedback" aria-live="polite"></div>
</div>
<!-- Contenedor de Respuestas (Estilo Kahoot, lo rellena js/juego.js) -->
<!-- RESPUESTAS -->
<div class="answers-grid" id="respuestas"></div>
<!-- JAVASCRIPT -->
<script src="js/jquery-4.0.0.min.js"></script>
<script src="js/juego.js"></script>
</body>
</html>