|
|
@ -23,6 +23,16 @@ switch ($submit = form_get_action()) { |
|
|
|
case 'edit': $action = ACT_EDIT; break; |
|
|
|
case 'edit': $action = ACT_EDIT; break; |
|
|
|
case 'del': $action = ACT_DELETE; break; |
|
|
|
case 'del': $action = ACT_DELETE; break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'exec-edit': |
|
|
|
|
|
|
|
if ($_POST['action'] == 'natadd') { |
|
|
|
|
|
|
|
$action = ACT_ADD; |
|
|
|
|
|
|
|
} elseif ($_POST['action'] == 'natdel') { |
|
|
|
|
|
|
|
$action = ACT_DELETE; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$g_warning->Add('Invalid action: '. $_POST['action']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'insert': |
|
|
|
case 'insert': |
|
|
|
$node_id_ext = sanitize($_POST['node_id_ext']); |
|
|
|
$node_id_ext = sanitize($_POST['node_id_ext']); |
|
|
|
$node_id_int = sanitize($_POST['node_id_int']); |
|
|
|
$node_id_int = sanitize($_POST['node_id_int']); |
|
|
@ -39,7 +49,11 @@ switch ($submit = form_get_action()) { |
|
|
|
case 'delete': |
|
|
|
case 'delete': |
|
|
|
$node_id_ext = sanitize($_POST['node_id_ext']); |
|
|
|
$node_id_ext = sanitize($_POST['node_id_ext']); |
|
|
|
$sth = $dbh->prepare("DELETE FROM nat WHERE nat_id=?"); |
|
|
|
$sth = $dbh->prepare("DELETE FROM nat WHERE nat_id=?"); |
|
|
|
$sth->execute([$id]); |
|
|
|
try { |
|
|
|
|
|
|
|
$sth->execute([$id]); |
|
|
|
|
|
|
|
} catch (PDOException $e) { |
|
|
|
|
|
|
|
$g_warning->Add($e->getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
// TODO |
|
|
|
// TODO |
|
|
|
// header_location("node.php?f=view&id=" . $node_id_ext); |
|
|
|
// header_location("node.php?f=view&id=" . $node_id_ext); |
|
|
|
$action = ACT_DEFAULT; |
|
|
|
$action = ACT_DEFAULT; |
|
|
@ -76,7 +90,7 @@ $smarty->display("nat.tpl"); |
|
|
|
elseif ($action == ACT_ADD): |
|
|
|
elseif ($action == ACT_ADD): |
|
|
|
// ========== VARIANT: add record ============================================= |
|
|
|
// ========== VARIANT: add record ============================================= |
|
|
|
|
|
|
|
|
|
|
|
$node_id = sanitize($_GET['node_id']); |
|
|
|
$node_id = sanitize($_REQUEST['node_id']); |
|
|
|
|
|
|
|
|
|
|
|
// node_ext |
|
|
|
// node_ext |
|
|
|
$sql = "SELECT node_ip AS node_ip_ext |
|
|
|
$sql = "SELECT node_ip AS node_ip_ext |
|
|
@ -151,7 +165,7 @@ $smarty->display("natedit.tpl"); |
|
|
|
elseif ($action == ACT_DELETE): |
|
|
|
elseif ($action == ACT_DELETE): |
|
|
|
// ========== VARIANT: delete record ========================================== |
|
|
|
// ========== VARIANT: delete record ========================================== |
|
|
|
|
|
|
|
|
|
|
|
$node_id = sanitize($_GET['node_id']); |
|
|
|
$node_id = sanitize($_REQUEST['node_id']); |
|
|
|
|
|
|
|
|
|
|
|
// node_ext |
|
|
|
// node_ext |
|
|
|
$sth = $dbh->prepare("SELECT node_id AS id_ext, node_ip AS ip_ext FROM node WHERE node_id=?"); |
|
|
|
$sth = $dbh->prepare("SELECT node_id AS id_ext, node_ip AS ip_ext FROM node WHERE node_id=?"); |
|
|
|