prepare("SELECT * FROM plantillas_telegram WHERE id = ?"); $stmt->execute([$id]); $plantilla = $stmt->fetch(); if (!$plantilla) { header('Location: list.php'); exit; } // Verificar propiedad de la plantilla si no es Admin if ($userData->rol !== 'Admin' && $plantilla['usuario_id'] != $userData->userId) { die('No tienes permiso para editar esta plantilla, ya que no te pertenece.'); } $error = $_GET['error'] ?? ''; $success = $_GET['success'] ?? ''; ?>