<?php
session_start();
require('routeros_api.class.php');

$id = $_GET['id'] ?? '';
if (!$id) exit("❌ ID tidak ditemukan.");

$API = new RouterosAPI();
$API->debug = false;
if ($API->connect($_SESSION['ip'], $_SESSION['user'], $_SESSION['pass'])) {
    $API->comm("/ip/firewall/nat/remove", [".id" => $id]);
    $API->disconnect();
    echo "<script>alert('✅ NAT berhasil dihapus');window.location='firewall_nat.php';</script>";
} else {
    echo "<script>alert('❌ Gagal konek ke Mikrotik');history.back();</script>";
}
