<?php
define('SITE_NAME', 'My Website'); // Admin → Settings → 'সাইটের নাম' থেকেও পরিবর্তন করা যাবে
define('BASE_URL', '/nid'); // যদি subfolder এ থাকে, e.g. '/nid-platform'
define('CURRENCY', '৳');
date_default_timezone_set('Asia/Dhaka');

// --- 30-day session lifetime (persistent login) ---
if (session_status() === PHP_SESSION_NONE) {
    $lifetime = 30 * 86400; // 30 days
    ini_set('session.gc_maxlifetime', (string)$lifetime);
    ini_set('session.cookie_lifetime', (string)$lifetime);
    session_set_cookie_params([
        'lifetime' => $lifetime,
        'path'     => '/',
        'secure'   => !empty($_SERVER['HTTPS']),
        'httponly' => true,
        'samesite' => 'Lax',
    ]);
    session_start();
}

require_once __DIR__.'/db.php';
require_once __DIR__.'/../includes/functions.php';
require_once __DIR__.'/../includes/csrf.php';
require_once __DIR__.'/../includes/auth.php';
require_once __DIR__.'/../includes/remember.php';
require_once __DIR__.'/../includes/activity.php';
require_once __DIR__.'/../includes/telegram.php';

// Try to auto-login via remember-me cookie (before any auth check)
remember_try_login($pdo);

// heartbeat — track logged-in user's last active time
activity_heartbeat($pdo);
