39331-vm/auth_login.php
Flatlogic Bot 522a55296c arsip_demo
2026-03-26 11:04:24 +00:00

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');