18 lines
259 B
PHP
18 lines
259 B
PHP
<?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;
|
|
}
|
|
} |