JezK
Edit File: index.php
<?php // Root index - safe redirect by role require_once __DIR__ . '/config/config.php'; require_once __DIR__ . '/config/db.php'; require_once __DIR__ . '/config/auth.php'; if (session_status() === PHP_SESSION_NONE) session_start(); if (!empty($_SESSION['user_id'])) { $role = get_session_role(); if (in_array($role, ['admin', 'superadmin'], true)) { header('Location: ' . APP_URL . '/admin/dashboard.php'); exit; } elseif ($role === 'accountant') { header('Location: ' . APP_URL . '/accountant/dashboard.php'); exit; } elseif ($role === 'operator') { header('Location: ' . APP_URL . '/operator/dashboard.php'); exit; } else { session_unset(); session_destroy(); header('Location: ' . APP_URL . '/auth/login.php'); exit; } } else { header('Location: ' . APP_URL . '/auth/login.php'); exit; }