Design angepasst

This commit is contained in:
Borgal
2025-08-11 17:02:16 +02:00
parent ab9dec7e2d
commit a808daaff8
6 changed files with 95 additions and 41 deletions

View File

@@ -3,10 +3,10 @@ session_start();
require_once '../inc/header.php'; ?> require_once '../inc/header.php'; ?>
<div class="container"> <div class="container mt-5">
<h1 class="mb-4">Debug-Informationen</h1> <h2 class="mb-4">Debug-Informationen</h2>
<div class="card mb-4"> <div class="card shadow mb-4">
<div class="card-header bg-primary text-white"> <div class="card-header bg-primary text-white">
<h4>Session-Daten ($_SESSION)</h4> <h4>Session-Daten ($_SESSION)</h4>
</div> </div>
@@ -19,7 +19,7 @@ require_once '../inc/header.php'; ?>
</div> </div>
</div> </div>
<div class="card"> <div class="card shadow">
<div class="card-header bg-success text-white"> <div class="card-header bg-success text-white">
<h4>Cookie-Daten ($_COOKIE)</h4> <h4>Cookie-Daten ($_COOKIE)</h4>
</div> </div>

View File

@@ -135,7 +135,7 @@ require_once '../inc/header.php';
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Hex-Code</th> <th>Hex-Code</th>
<th>Vorschau</th> <th>Farbe</th>
<th>Aktionen</th> <th>Aktionen</th>
</tr> </tr>
</thead> </thead>

View File

@@ -7,8 +7,10 @@ if ($_SESSION['role'] !== 'admin') {
die("Zugriff nur für Admins"); die("Zugriff nur für Admins");
} }
// Datenbankverbindung einbinden $message = '';
$message_type = '';
$edit_mode = false;
$edit_user = null;
// Benutzer hinzufügen // Benutzer hinzufügen
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['username'], $_POST['password'], $_POST['role'])) { if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['username'], $_POST['password'], $_POST['role'])) {
@@ -19,8 +21,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['username'], $_POST['pa
$sql = "INSERT INTO users (username, password, role) VALUES ('$username', '$password', '$role')"; $sql = "INSERT INTO users (username, password, role) VALUES ('$username', '$password', '$role')";
if (mysqli_query($conn, $sql)) { if (mysqli_query($conn, $sql)) {
$message = "Benutzer erfolgreich hinzugefügt."; $message = "Benutzer erfolgreich hinzugefügt.";
$message_type = 'success';
} else { } else {
$message = "Fehler beim Hinzufügen: " . mysqli_error($conn); $message = "Fehler beim Hinzufügen: " . mysqli_error($conn);
$message_type = 'danger';
} }
} }
@@ -33,39 +37,91 @@ if ($result) {
} }
} }
require_once '../inc/header.php'; require_once('../inc/header.php');
?> ?>
<h1>Benutzerverwaltung</h1> <div class="container mt-5">
<h2 class="mb-4">Benutzerverwaltung</h2>
<?php if (isset($message)) echo "<p><strong>$message</strong></p>"; ?> <?php if ($message) : ?>
<div id="status-message" class="alert alert-<?php echo $message_type; ?> alert-dismissible fade show" role="alert">
<?php echo htmlspecialchars($message); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php endif; ?>
<div class="card shadow mb-4">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Neuen Benutzer hinzufügen</h4>
</div>
<div class="card-body">
<form method="post"> <form method="post">
<label>Benutzername: <input type="text" name="username" required></label><br> <div class="row g-3 align-items-end">
<label>Passwort: <input type="password" name="password" required></label><br> <div class="col-md-4">
<label>Rolle: <label for="username" class="form-label">Benutzername</label>
<select name="role"> <input type="text" class="form-control" id="username" name="username" required>
<div class="form-text" style="visibility: hidden;">&nbsp;</div>
</div>
<div class="col-md-4">
<label for="password" class="form-label">Passwort</label>
<input type="password" class="form-control" id="password" name="password" required>
<div class="form-text" style="visibility: hidden;">&nbsp;</div>
</div>
<div class="col-md-4 d-flex flex-column justify-content-end">
<label for="role" class="form-label">Rolle</label>
<div class="d-flex w-100">
<select class="form-select w-100" id="role" name="role">
<option value="member">Mitglied</option> <option value="member">Mitglied</option>
<option value="admin">Admin</option> <option value="admin">Admin</option>
</select> </select>
</label><br>
<button type="submit">Benutzer hinzufügen</button>
</form>
<h2>Benutzerübersicht</h2> </div>
<table border="1" cellpadding="5"> </div><button type="submit" class="btn btn-primary ms-2">Hinzufügen</button>
</div>
</form>
</div>
</div>
<div class="card shadow">
<div class="card-header bg-secondary text-white">
<h4 class="mb-0">Benutzerübersicht</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Benutzername</th> <th>Benutzername</th>
<th>Rolle</th> <th>Rolle</th>
<th>Aktionen</th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?> <?php foreach ($users as $user): ?>
<tr> <tr>
<td><?= htmlspecialchars($user['id']) ?></td> <td><?= htmlspecialchars($user['id']) ?></td>
<td><?= htmlspecialchars($user['username']) ?></td> <td><?= htmlspecialchars($user['username']) ?></td>
<td><?= htmlspecialchars($user['role']) ?></td> <td>
<span class="badge rounded-pill bg-<?= $user['role'] === 'admin' ? 'info' : 'secondary' ?>">
<?= htmlspecialchars($user['role']) ?>
</span>
</td>
<td>
<a href="#" class="text-dark me-1 text-decoration-none" data-bs-toggle="tooltip" data-bs-placement="top" title="Bearbeiten">
<span class="material-icons">mode_edit_outline</span>
</a>
<a href="#" class="text-danger text-decoration-none" data-bs-toggle="tooltip" data-bs-placement="top" title="Löschen">
<span class="material-icons">delete_outline</span>
</a>
</td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody>
</table> </table>
</div>
</div>
</div>
</div>
<?php include('../inc/footer.php'); ?> <?php include('../inc/footer.php'); ?>

View File

@@ -1,5 +1,6 @@
body { body {
background-color: #e6e6e6ff; background-color: #e6e6e6ff;
padding-top: 40px; /* Anpassen an die Höhe Ihres Menüs */
} }
.container { .container {

View File

@@ -14,9 +14,6 @@
<link rel="stylesheet" href="../css/style.css"> <link rel="stylesheet" href="../css/style.css">
</head> </head>
<!-- Farbe über Bootstrap festlegen mit Transparent -->
<!-- <body class="bg-info bg-opacity-10"> -->
<body> <body>
<? include('menu.php') ?> <? include('menu.php') ?>

View File

@@ -1,4 +1,4 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand d-flex" href="../index.php">DoMiLi</a> <a class="navbar-brand d-flex" href="../index.php">DoMiLi</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
@@ -25,7 +25,7 @@
<a class="nav-link d-flex align-items-center dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"><span class="material-icons md-18 me-1">admin_panel_settings</span>Admin</a> <a class="nav-link d-flex align-items-center dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"><span class="material-icons md-18 me-1">admin_panel_settings</span>Admin</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a class="dropdown-item" href="../admin/colors.php">Farben</a></li> <li><a class="dropdown-item" href="../admin/colors.php">Farben</a></li>
<li><a class="dropdown-item" href="../admin/date.php">Termine</a></li> <li><a class="dropdown-item" href="../admin/meeting.php">Termine</a></li>
<li><a class="dropdown-item" href="../admin/users.php">Benutzer</a></li> <li><a class="dropdown-item" href="../admin/users.php">Benutzer</a></li>
<li><a class="dropdown-item" href="../admin/check_session.php">Session prüfen</a></li> <li><a class="dropdown-item" href="../admin/check_session.php">Session prüfen</a></li>
</ul> </ul>