diff --git a/public/index.php b/public/index.php index 7b661bd..1af61d3 100644 --- a/public/index.php +++ b/public/index.php @@ -11,7 +11,27 @@ use App\Models\Season; $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); -if ($uri === '/' || $uri === '/index.php') { +// Routing basierend auf Query-Parametern, um Probleme mit URL-Rewriting zu umgehen +if (($_GET['page'] ?? null) === 'round' && isset($_GET['id'])) { + try { + $roundId = (int)$_GET['id']; + $round = Round::getById($roundId); + + if (!$round) { + http_response_code(404); + echo "404 Not Found: Runde nicht gefunden."; + exit; + } + + $games = Game::getGamesByRound($roundId); + + // Lade das View-Template für die Rundenansicht + require __DIR__ . '/../src/Views/round.php'; + } catch (Throwable $e) { + http_response_code(500); + echo "
Fehler: " . htmlspecialchars($e->getMessage()) . "
"; + } +} elseif ($uri === '/' || $uri === '/index.php') { echo "Dies ist die Nachfolgeversion des alten Tippspiels (Pure PHP Variante).
"; @@ -32,7 +52,8 @@ if ($uri === '/' || $uri === '/index.php') { if ($rounds) { echo "Fehler: " . htmlspecialchars($e->getMessage()) . "
"; - } } else { http_response_code(404); echo "404 Not Found";