<?php
declare(strict_types=1);

if (session_status() === PHP_SESSION_NONE) {
    $secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
    if (PHP_VERSION_ID >= 70300) {
        session_set_cookie_params([
            'lifetime' => 0,
            'path' => '/',
            'secure' => $secure,
            'httponly' => true,
            'samesite' => 'Lax',
        ]);
    } else {
        // PHP < 7.3 compatibility (common on older shared hosting).
        session_set_cookie_params(0, '/; samesite=Lax', '', $secure, true);
    }
    session_start();
}

date_default_timezone_set('Europe/Kyiv');

require_once __DIR__ . '/config.php';
require_once __DIR__ . '/helpers.php';
