Add includes/auth.php

This commit is contained in:
2026-06-15 09:36:44 +02:00
parent 23dd1b312e
commit 96623f96b6
+18
View File
@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/config.php';
function isLoggedIn(): bool
{
return isset($_SESSION['user']);
}
function requireLogin(): void
{
if (!isLoggedIn()) {
header('Location: login.php');
exit;
}
}