22 lines
688 B
PHP
22 lines
688 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/archive_bootstrap.php';
|
|
ensure_archive_table();
|
|
verify_csrf_or_fail();
|
|
|
|
$username = trim((string) ($_POST['username'] ?? ''));
|
|
$password = (string) ($_POST['password'] ?? '');
|
|
$catalog = users_catalog();
|
|
|
|
if ($username === '' || $password === '' || !isset($catalog[$username]) || !password_verify($password, $catalog[$username]['password_hash'])) {
|
|
flash('error', 'Username atau password tidak sesuai.');
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
session_regenerate_id(true);
|
|
$_SESSION['auth_username'] = $username;
|
|
flash('success', 'Login berhasil. Silakan lanjutkan pengelolaan arsip.');
|
|
header('Location: index.php');
|