fix
This commit is contained in:
@@ -21,7 +21,7 @@ define('DB_CHARSET', 'utf8mb4'); // Charset per supportare tutti i cara
|
||||
// ============================================
|
||||
|
||||
define('SITE_NAME', 'Pilates Studio');
|
||||
define('SITE_URL', 'http://localhost/pilates-platform'); // Modifica con il tuo dominio in produzione
|
||||
define('SITE_URL', 'https://demo-pilates.pyconetwork.it'); // URL del sito in produzione
|
||||
define('ADMIN_EMAIL', 'admin@pilatesstudio.com'); // Email amministratore
|
||||
|
||||
// Contatti opzionali (lascia vuoto se non vuoi mostrarli)
|
||||
|
||||
@@ -33,7 +33,11 @@ function is_admin() {
|
||||
function require_login() {
|
||||
if (!is_logged_in()) {
|
||||
$_SESSION['redirect_after_login'] = $_SERVER['REQUEST_URI'];
|
||||
header('Location: ' . SITE_URL . '/login.php');
|
||||
// Determina il percorso relativo al login basato sulla directory corrente
|
||||
$login_path = (strpos($_SERVER['SCRIPT_NAME'], '/admin/') !== false || strpos($_SERVER['SCRIPT_NAME'], '/user/') !== false)
|
||||
? '../login.php'
|
||||
: 'login.php';
|
||||
header('Location: ' . $login_path);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -45,7 +49,11 @@ function require_admin() {
|
||||
require_login();
|
||||
|
||||
if (!is_admin()) {
|
||||
header('Location: ' . SITE_URL . '/index.php');
|
||||
// Determina il percorso relativo all'index basato sulla directory corrente
|
||||
$index_path = (strpos($_SERVER['SCRIPT_NAME'], '/admin/') !== false || strpos($_SERVER['SCRIPT_NAME'], '/user/') !== false)
|
||||
? '../index.php'
|
||||
: 'index.php';
|
||||
header('Location: ' . $index_path);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user