'PEGA_AQUI_EL_HASH_BCRYPT', // Para agregar más usuarios: 'nombre' => 'hash', ]; define('DQ_DASHBOARD', __DIR__ . '/data/dashboard.html'); define('DQ_SESSION', 'dq_auth_v1'); // ============================================================ ini_set('session.cookie_httponly', '1'); ini_set('session.cookie_samesite', 'Lax'); if (!empty($_SERVER['HTTPS'])) { ini_set('session.cookie_secure', '1'); } session_name('dq_sess'); session_start(); // Logout if (($_GET['action'] ?? '') === 'logout') { session_destroy(); header('Location: ' . strtok($_SERVER['REQUEST_URI'], '?')); exit; } // Procesar login $error = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $user = strtolower(trim($_POST['u'] ?? '')); $pass = $_POST['p'] ?? ''; if (!empty($DQ_USERS[$user]) && password_verify($pass, $DQ_USERS[$user])) { session_regenerate_id(true); $_SESSION[DQ_SESSION] = $user; header('Location: ' . strtok($_SERVER['REQUEST_URI'], '?')); exit; } $error = 'Usuario o contraseña incorrectos.'; sleep(1); // frena ataques de fuerza bruta } // Autenticado → servir dashboard con logout if (!empty($_SESSION[DQ_SESSION])) { if (!file_exists(DQ_DASHBOARD)) { http_response_code(503); die('

Dashboard aún no disponible. Sube data/dashboard.html.

'); } $html = file_get_contents(DQ_DASHBOARD); $logout_btn = '
' . htmlspecialchars($_SESSION[DQ_SESSION]) . ' Salir
'; $html = str_replace('', $logout_btn . '', $html); header('Content-Type: text/html; charset=UTF-8'); header('Cache-Control: no-store, no-cache, must-revalidate'); echo $html; exit; } ?> Daniel Quién — Acceso

DANIEL QUIÉN

Dashboard — Acceso Equipo