|
|
|
@ -102,19 +102,21 @@ switch ($submit = form_get_action()) { |
|
|
|
|
$info = sanitize($_POST['subnet_info']); |
|
|
|
|
$dhcp_start = sanitize($_POST['dhcp_start']); |
|
|
|
|
$dhcp_end = sanitize($_POST['dhcp_end']); |
|
|
|
|
$ntp_server = sanitize($_POST['ntp_server']); |
|
|
|
|
$sql = "INSERT INTO subnet ( |
|
|
|
|
subnet_address, subnet_mask, subnet_info, |
|
|
|
|
subnet_dhcp_start, subnet_dhcp_end |
|
|
|
|
subnet_dhcp_start, subnet_dhcp_end, ntp_server |
|
|
|
|
) VALUES ( |
|
|
|
|
:address, :mask, :info, |
|
|
|
|
:dhcp_start, :dhcp_end |
|
|
|
|
:dhcp_start, :dhcp_end, :ntp_server |
|
|
|
|
)"; |
|
|
|
|
$sth = $dbh->prepare($sql); |
|
|
|
|
$sth->bindValue(':address', $address, PDO::PARAM_STR); |
|
|
|
|
$sth->bindValue(':mask', $mask, PDO::PARAM_INT); |
|
|
|
|
$sth->bindValue(':info', $info, PDO::PARAM_STR); |
|
|
|
|
$sth->bindValue(':dhcp_start', $dhcp_start, PDO::PARAM_STR); |
|
|
|
|
$sth->bindValue(':dhcp_end', $dhcp_end, PDO::PARAM_STR); |
|
|
|
|
$sth->bindValue(':ntp_server', $ntp_server, PDO::PARAM_STR); |
|
|
|
|
$sth->bindValue(':info', $info, PDO::PARAM_STR); |
|
|
|
|
$sth->execute(); |
|
|
|
|
$id = $dbh->lastInsertId(); |
|
|
|
|
// vlan if selected |
|
|
|
@ -128,13 +130,13 @@ switch ($submit = form_get_action()) { |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 'update': |
|
|
|
|
$subnet_address= sanitize($_POST['subnet_address']); |
|
|
|
|
$subnet_proto_vers = sanitize($_POST['subnet_proto_vers']); |
|
|
|
|
$subnet_mask = sanitize($_POST['subnet_mask']); |
|
|
|
|
$subnet_dhcpstart = sanitize($_POST['subnet_dhcpstart']); |
|
|
|
|
$subnet_dhcpend = sanitize($_POST['subnet_dhcpend']); |
|
|
|
|
$subnet_ntp_server = sanitize($_POST['subnet_ntp_server']); |
|
|
|
|
$subnet_info = sanitize($_POST['subnet_info']); |
|
|
|
|
$address= sanitize($_POST['subnet_address']); |
|
|
|
|
$proto_vers = sanitize($_POST['subnet_proto_vers']); |
|
|
|
|
$mask = sanitize($_POST['subnet_mask']); |
|
|
|
|
$dhcp_start = sanitize($_POST['dhcp_start']); |
|
|
|
|
$dhcp_end = sanitize($_POST['dhcp_end']); |
|
|
|
|
$ntp_server = sanitize($_POST['ntp_server']); |
|
|
|
|
$info = sanitize($_POST['subnet_info']); |
|
|
|
|
|
|
|
|
|
$sql = "UPDATE subnet SET |
|
|
|
|
subnet_address=?, subnet_mask=?, subnet_dhcp_start=?, |
|
|
|
@ -142,9 +144,9 @@ switch ($submit = form_get_action()) { |
|
|
|
|
ntp_server=? |
|
|
|
|
WHERE subnet_id=?"; |
|
|
|
|
$sth = $dbh->prepare($sql); |
|
|
|
|
$sth->execute([$subnet_address, $subnet_mask, $subnet_dhcpstart, |
|
|
|
|
$subnet_dhcpend, $subnet_info, $subnet_proto_vers, |
|
|
|
|
$subnet_ntp_server, $id]); |
|
|
|
|
$sth->execute([$address, $mask, $dhcp_start, |
|
|
|
|
$dhcp_end, $info, $proto_vers, |
|
|
|
|
$ntp_server, $id]); |
|
|
|
|
$action = ACT_VIEW; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
@ -176,6 +178,7 @@ switch ($submit = form_get_action()) { |
|
|
|
|
$g_error->Add(submit_error($submit)); |
|
|
|
|
$valid = FALSE; |
|
|
|
|
} |
|
|
|
|
$smarty->assign("action", $action); |
|
|
|
|
|
|
|
|
|
// ========== ACTIONS END ===================================================== |
|
|
|
|
|
|
|
|
@ -205,7 +208,7 @@ if((isset($_GET['vlan_id'])) ? $vlan_id = sanitize($_GET['vlan_id']) : $vlan_id |
|
|
|
|
$smarty->assign("vlan_id", $vlan_id); |
|
|
|
|
$smarty->assign("vlan_options", db_get_options_vlan($lang['lang_option_none'])); |
|
|
|
|
|
|
|
|
|
$smarty->display("subnetadd.tpl"); |
|
|
|
|
$smarty->display("subnetedit.tpl"); |
|
|
|
|
|
|
|
|
|
elseif ($action == ACT_VIEW): |
|
|
|
|
// ========== VARIANT: view single record ===================================== |
|
|
|
|