From 534886f8f3966c1ce2a070fa1a6c4adafbc1a84a Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Thu, 10 Oct 2024 15:04:12 +0100 Subject: [PATCH] Fix app stage issue --- system/autoload/Admin.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system/autoload/Admin.php b/system/autoload/Admin.php index bcc0c0c3..d6b51718 100644 --- a/system/autoload/Admin.php +++ b/system/autoload/Admin.php @@ -77,8 +77,8 @@ class Admin // Detect the current protocol $isSecure = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; - $app_stage = ($_app_stage === 'Live') ? APP_URL : ''; - + $serverHost = $_SERVER['HTTP_HOST']; + $app_stage = ($serverHost === 'localhost') ? '' : APP_URL; // Set cookie with security flags setcookie('aid', $token, [ 'expires' => time() + 86400 * 7, // 7 days @@ -108,7 +108,8 @@ class Admin global $_app_stage; if (isset($_COOKIE['aid'])) { $isSecure = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; - $app_stage = ($_app_stage === 'Live') ? APP_URL : ''; + $serverHost = $_SERVER['HTTP_HOST']; + $app_stage = ($serverHost === 'localhost') ? '' : APP_URL; setcookie('aid', '', [ 'expires' => time() - 3600, 'path' => '/',