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