feat: added design for navbar and Background; edited DC-Handler; added roles for right calling; added check for highest role; added DC-Login page + Button

This commit is contained in:
Ioannis
2025-07-06 19:13:18 +02:00
commit e3080940b5
8 changed files with 352 additions and 0 deletions

56
index.php Normal file
View File

@@ -0,0 +1,56 @@
<?php
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>
<div class="navbar">
<div class="navbar-links" id="mobileMenu">
<a href="index.php">🏠 Home</a>
<?php if ($_SESSION['user']['hasRole']): ?>
<a href="admin.php">✍️ Eintragung</a>
<div class="dropdown">
<a href="#">📂 Verwaltung ▼</a>
<div class="dropdown-content">
<a href="statistik.php">📊 Statistik</a>
<a href="lager.php">🔧 Lager</a>
<a href="#">📝 Platzhalter</a>
</div>
</div>
<?php endif; ?>
</div>
<div class="user-info">
<img src="https://cdn.discordapp.com/avatars/<?php echo $_SESSION['user']['id']; ?>/<?php echo $_SESSION['user']['avatar']; ?>.png" alt="Avatar">
<span><?php echo htmlspecialchars($_SESSION['user']['nickname']); ?></span>
<a href="logout.php"><button class="logout-btn">Logout</button></a>
<span class="burger" onclick="toggleMenu()">☰</span>
</div>
</div>
<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: ?>
<p>Du hast nicht die erforderliche Rolle für Admin-Menüpunkte.</p>
<?php endif; ?>
</div>
<script>
function toggleMenu() {
document.getElementById("mobileMenu").classList.toggle("show");
}
</script>
</body>
</html>