<?php
if (!isset($_SESSION)) session_start();
if (!isset($_SESSION['user'])) {
    header('Location: loginform.php');
    exit;
}?>

<!DOCTYPE html>
<html>
<head>
    <title>Willkommen</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
 <?php include "header.php";?>

    <div style="padding: 20px;">
        <h1>Willkommen, <?php echo htmlspecialchars($_SESSION['user']['nickname']); ?>!</h1>

        <?php if ($_SESSION['user']['hasRole']): ?>
            <p>Du bist als <strong><?php echo htmlspecialchars($_SESSION['user']['main_role']); ?></strong> eingeloggt.</p>
        <?php else: 
            session_destroy();
            exit();
        endif; ?>
    </div>

    <script>
        function toggleMenu() {
            document.getElementById("mobileMenu").classList.toggle("show");
        }
    </script>
</body>
</html>
