prepare("SELECT id, name, password FROM agents WHERE email = ?"); $stmt->execute([$email]); $agent = $stmt->fetch(); if ($agent && password_verify($password, $agent['password'])) { // Password is correct, start session $_SESSION['agent_id'] = $agent['id']; $_SESSION['agent_name'] = $agent['name']; header("Location: dashboard.php"); exit; } else { $errors[] = 'Email o contraseña incorrectos.'; } } } include 'templates/header.php'; ?>

Login de Agente