43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../src/config.php';
|
|
require_once __DIR__ . '/../src/auth.php';
|
|
|
|
$error = '';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$user = $_POST['username'] ?? '';
|
|
$pass = $_POST['password'] ?? '';
|
|
if (login($user, $pass)) {
|
|
header('Location: ' . url_for('index.php'));
|
|
exit;
|
|
} else {
|
|
$error = 'Login fehlgeschlagen.';
|
|
}
|
|
}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>PIRP Login</title>
|
|
<link rel="stylesheet" href="assets/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="login-wrap">
|
|
<div class="login-box">
|
|
<h1>PIRP</h1>
|
|
<?php if ($error): ?><p class="error"><?= htmlspecialchars($error) ?></p><?php endif; ?>
|
|
<form method="post">
|
|
<label>Benutzer:
|
|
<input type="text" name="username" required autofocus>
|
|
</label>
|
|
<label>Passwort:
|
|
<input type="password" name="password" required>
|
|
</label>
|
|
<button type="submit" style="width:100%;margin-top:4px;">Login</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|