Fix login redirect and hide PHP errors on pages

This commit is contained in:
Thanakorn
2026-09-14 12:46:13 +07:00
parent 3045c4a8ef
commit c3113bc70d
3 changed files with 29 additions and 0 deletions
+5
View File
@@ -8,6 +8,11 @@ require_once __DIR__ . '/assets/utils/classes/UsageGuard.php';
// login_company_id is only written by login_confirm.php after OTP is verified —
// using it (not "otp") ensures half-logged-in sessions are also redirected.
if(empty($_SESSION["login_company_id"])){
// Discard the markup include_header.php has already buffered so the browser
// receives a clean redirect rather than a partially rendered page body.
while (ob_get_level() > 0) {
ob_end_clean();
}
header('Location: '.$server_url.'login/index.php');
exit;
}