|
@@ -1,5 +1,6 @@
|
|
|
<?php
|
|
<?php
|
|
|
require_once __DIR__ . '/../config.php';
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
|
+require_once __DIR__ . '/../includes/functions.php';
|
|
|
|
|
|
|
|
// Handle logout
|
|
// Handle logout
|
|
|
if (isset($_GET['logout'])) {
|
|
if (isset($_GET['logout'])) {
|
|
@@ -12,14 +13,16 @@ if (isset($_GET['logout'])) {
|
|
|
$error = '';
|
|
$error = '';
|
|
|
|
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
|
|
+ $username = sanitize($_POST['username'] ?? '');
|
|
|
$password = $_POST['password'] ?? '';
|
|
$password = $_POST['password'] ?? '';
|
|
|
|
|
|
|
|
- if (password_verify($password, ADMIN_PASSWORD_HASH)) {
|
|
|
|
|
|
|
+ $users = defined('ADMIN_USERS') ? ADMIN_USERS : [];
|
|
|
|
|
+ if (isset($users[$username]) && password_verify($password, $users[$username])) {
|
|
|
$_SESSION['admin_logged_in'] = true;
|
|
$_SESSION['admin_logged_in'] = true;
|
|
|
header('Location: index.php');
|
|
header('Location: index.php');
|
|
|
exit;
|
|
exit;
|
|
|
} else {
|
|
} else {
|
|
|
- $error = 'Falsches Passwort.';
|
|
|
|
|
|
|
+ $error = 'Benutzername oder Passwort falsch.';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -54,9 +57,13 @@ if (isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in']) {
|
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<form method="POST" style="background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
|
<form method="POST" style="background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <label for="username">Benutzername:</label>
|
|
|
|
|
+ <input type="text" id="username" name="username" required autofocus>
|
|
|
|
|
+ </div>
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
<label for="password">Passwort:</label>
|
|
<label for="password">Passwort:</label>
|
|
|
- <input type="password" id="password" name="password" required autofocus>
|
|
|
|
|
|
|
+ <input type="password" id="password" name="password" required>
|
|
|
</div>
|
|
</div>
|
|
|
<button type="submit" class="btn" style="width: 100%;">Anmelden</button>
|
|
<button type="submit" class="btn" style="width: 100%;">Anmelden</button>
|
|
|
</form>
|
|
</form>
|