Fix: Usar APP_URL del .env para redirección al login
This commit is contained in:
@@ -24,8 +24,10 @@ function checkSession(): void
|
||||
validateSessionDomain();
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
$appUrl = $_ENV['APP_URL'] ?? getenv('APP_URL') ?? '';
|
||||
$parsed = parse_url($appUrl);
|
||||
$scheme = $parsed['scheme'] ?? 'https';
|
||||
$host = $parsed['host'] ?? $_SERVER['HTTP_HOST'] ?? 'localhost';
|
||||
header('Location: ' . $scheme . '://' . $host . '/login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user