query("SELECT * FROM recipients ORDER BY platform, name"); $recipients = $stmt->fetchAll(); $stmt = $pdo->query("SELECT * FROM supported_languages ORDER BY language_name"); $languages = $stmt->fetchAll(); } catch (Exception $e) { $error = $e->getMessage(); } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) { $action = $_POST['action']; if ($action === 'add') { $platformId = $_POST['platform_id']; $name = $_POST['name']; $type = $_POST['type']; $platform = $_POST['platform']; $languageCode = $_POST['language_code']; $stmt = $pdo->prepare(" INSERT INTO recipients (platform_id, name, type, platform, language_code, created_at) VALUES (?, ?, ?, ?, ?, NOW()) "); $stmt->execute([$platformId, $name, $type, $platform, $languageCode]); logActivity(getCurrentUserId(), 'add_recipient', "Destinatario agregado: $name ($platform)"); header('Location: recipients.php'); exit; } elseif ($action === 'update_language') { $recipientId = (int) $_POST['recipient_id']; $languageCode = $_POST['language_code']; $stmt = $pdo->prepare("UPDATE recipients SET language_code = ? WHERE id = ?"); $stmt->execute([$languageCode, $recipientId]); header('Location: recipients.php'); exit; } elseif ($action === 'delete') { $recipientId = (int) $_POST['recipient_id']; $stmt = $pdo->prepare("DELETE FROM recipients WHERE id = ?"); $stmt->execute([$recipientId]); logActivity(getCurrentUserId(), 'delete_recipient', "Destinatario eliminado ID: $recipientId"); header('Location: recipients.php'); exit; } } require_once __DIR__ . '/../templates/header.php'; ?>

$r['platform'] === 'discord'); ?>

Platform ID
$r['platform'] === 'telegram'); ?>

Platform ID