76 lines
2.2 KiB
PHP
76 lines
2.2 KiB
PHP
<?php
|
|
require_once __DIR__ . '/config/config.php';
|
|
session_start();
|
|
|
|
// Verificar autenticación
|
|
if (!isset($_SESSION['autenticado']) || !$_SESSION['autenticado']) {
|
|
header('Location: /login');
|
|
exit;
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title><?php echo ucfirst($_GET['page'] ?? 'Inicio'); ?> - Comparador de Precios</title>
|
|
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
|
<link rel="stylesheet" href="/assets/css/tailwind.css">
|
|
<meta name="description" content="Comparador de precios entre Argentina y otros países">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
</head>
|
|
<body class="bg-gray-50">
|
|
<!-- Navbar se renderiza dinámicamente -->
|
|
<div id="navbar"></div>
|
|
|
|
<?php
|
|
$page = $_GET['page'] ?? 'brasil';
|
|
$allowedPages = ['brasil', 'chile'];
|
|
|
|
if (!in_array($page, $allowedPages)) {
|
|
$page = 'brasil';
|
|
}
|
|
|
|
$pagePath = __DIR__ . '/pages/' . $page . '.html';
|
|
|
|
if (file_exists($pagePath)) {
|
|
include $pagePath;
|
|
} else {
|
|
echo '<div class="container mx-auto px-4 py-8"><h1 class="text-2xl text-red-600">Página no encontrada</h1></div>';
|
|
}
|
|
?>
|
|
|
|
<!-- Footer se renderiza dinámicamente -->
|
|
<div id="footer"></div>
|
|
|
|
<!-- Scripts -->
|
|
<script src="./assets/js/auth.js"></script>
|
|
<script src="./assets/js/layout.js"></script>
|
|
<script src="./assets/js/app.js"></script>
|
|
<script>
|
|
// Inicializar aplicación con layout
|
|
async function init() {
|
|
const page = '<?php echo $page; ?>';
|
|
const configs = {
|
|
brasil: {
|
|
title: 'Comparador de Precios - Brasil',
|
|
flag: '🇧🇷',
|
|
country: 'brasil'
|
|
},
|
|
chile: {
|
|
title: 'Comparador de Precios - Chile',
|
|
flag: '🇨🇱',
|
|
country: 'chile'
|
|
}
|
|
};
|
|
|
|
LayoutManager.init(configs[page]);
|
|
inicializarApp(page);
|
|
}
|
|
|
|
// Inicializar
|
|
init();
|
|
</script>
|
|
</body>
|
|
</html>
|