Design angepasst
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
118
admin/users.php
118
admin/users.php
@@ -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; ?>
|
||||||
|
|
||||||
<form method="post">
|
<div class="card shadow mb-4">
|
||||||
<label>Benutzername: <input type="text" name="username" required></label><br>
|
<div class="card-header bg-primary text-white">
|
||||||
<label>Passwort: <input type="password" name="password" required></label><br>
|
<h4 class="mb-0">Neuen Benutzer hinzufügen</h4>
|
||||||
<label>Rolle:
|
</div>
|
||||||
<select name="role">
|
<div class="card-body">
|
||||||
<option value="member">Mitglied</option>
|
<form method="post">
|
||||||
<option value="admin">Admin</option>
|
<div class="row g-3 align-items-end">
|
||||||
</select>
|
<div class="col-md-4">
|
||||||
</label><br>
|
<label for="username" class="form-label">Benutzername</label>
|
||||||
<button type="submit">Benutzer hinzufügen</button>
|
<input type="text" class="form-control" id="username" name="username" required>
|
||||||
</form>
|
<div class="form-text" style="visibility: hidden;"> </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;"> </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="admin">Admin</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
<h2>Benutzerübersicht</h2>
|
</div>
|
||||||
<table border="1" cellpadding="5">
|
</div><button type="submit" class="btn btn-primary ms-2">Hinzufügen</button>
|
||||||
<tr>
|
</div>
|
||||||
<th>ID</th>
|
</form>
|
||||||
<th>Benutzername</th>
|
</div>
|
||||||
<th>Rolle</th>
|
</div>
|
||||||
</tr>
|
|
||||||
<?php foreach ($users as $user): ?>
|
<div class="card shadow">
|
||||||
<tr>
|
<div class="card-header bg-secondary text-white">
|
||||||
<td><?= htmlspecialchars($user['id']) ?></td>
|
<h4 class="mb-0">Benutzerübersicht</h4>
|
||||||
<td><?= htmlspecialchars($user['username']) ?></td>
|
</div>
|
||||||
<td><?= htmlspecialchars($user['role']) ?></td>
|
<div class="card-body">
|
||||||
</tr>
|
<div class="table-responsive">
|
||||||
<?php endforeach; ?>
|
<table class="table table-striped table-hover">
|
||||||
</table>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Benutzername</th>
|
||||||
|
<th>Rolle</th>
|
||||||
|
<th>Aktionen</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($users as $user): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= htmlspecialchars($user['id']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($user['username']) ?></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>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php include('../inc/footer.php'); ?>
|
<?php include('../inc/footer.php'); ?>
|
||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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') ?>
|
||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user