update: login
This commit is contained in:
1 parent
4c560a7a10
commit
320420a4ce
2 files changed
+25
-2
No files matched your search
@@ -19,6 +19,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_user'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['password'])) {
|
||||
if (isset($superuser['admin']['password']) && $_POST['password'] === $superuser['admin']['password']) {
|
||||
$_SESSION['logged_in'] = true;
|
||||
} else {
|
||||
$error = "Falsches Passwort!";
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Daten für die Tabelle holen (dein bestehender Code)
|
||||
$specificData = new getSpecificData();
|
||||
$isAdmin = $specificData->getIsAdmin();
|
||||
@@ -36,6 +44,21 @@ if ($isAdmin) {
|
||||
?>
|
||||
|
||||
<div class="content">
|
||||
<?php if (!($_SESSION['logged_in'] ?? false)): ?>
|
||||
<div class="login-container">
|
||||
<div class="login-box">
|
||||
<form method="post">
|
||||
<h2>🔐 Login</h2>
|
||||
<?php if(isset($error)): ?>
|
||||
<div class="status-msg" style="background:#dc3545; color:#fff;"><?= htmlspecialchars($error) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="password" name="password" placeholder="Passwort" required>
|
||||
<button type="submit">Einloggen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<h2>Benutzerverwaltung</h2>
|
||||
|
||||
<?php if ($isAdmin): ?>
|
||||
@@ -92,4 +115,5 @@ if ($isAdmin) {
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -46,7 +46,6 @@ header {
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 20px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user