4096)) { $new['vlan_tag'] =1; } $new['office'] = $_POST['s_office'] * 1; $new['hotspot'] = $_POST['s_hotspot'] * 1; $new['vpn'] = $_POST['s_vpn'] * 1; $new['free'] = $_POST['s_free'] * 1; $new['dhcp'] = $_POST['s_dhcp'] * 1; $new['dhcp_lease_time'] = $_POST['s_lease_time'] * 1; $new['static'] = $_POST['s_static'] * 1; $new['discovery'] = $_POST['s_discovery'] * 1; $new['dhcp_update_hostname'] = $_POST['s_dhcp_update'] * 1; $new['comment'] = trim($_POST['s_comment']); $range = cidrToRange($new['subnet']); $first_user_ip = $range[0]; $last_user_ip = $range[1]; $cidr = $range[2][1]; if (isset($cidr) and $cidr <= 32) { $new['subnet'] = $first_user_ip . '/' . $cidr; } else { $new['subnet'] = ''; } $new['ip_int_start'] = ip2long($first_user_ip); $new['ip_int_stop'] = ip2long($last_user_ip); $new['dhcp_start'] = ip2long(trim($_POST['s_dhcp_start'])); $new['dhcp_stop'] = ip2long(trim($_POST['s_dhcp_stop'])); $dhcp_fail = 0; if (!isset($new['dhcp_start']) or $new['dhcp_start'] == 0) { $dhcp_fail = 1; } if (!isset($new['dhcp_stop']) or $new['dhcp_stop'] == 0) { $dhcp_fail = 1; } if (!$dhcp_fail and ($new['dhcp_start'] - $new['ip_int_stop'] >= 0)) { $dhcp_fail = 1; } if (!$dhcp_fail and ($new['dhcp_start'] - $new['ip_int_start'] <= 0)) { $dhcp_fail = 1; } if (!$dhcp_fail and ($new['dhcp_stop'] - $new['ip_int_stop'] >= 0)) { $dhcp_fail = 1; } if (!$dhcp_fail and ($new['dhcp_stop'] - $new['ip_int_start'] <= 0)) { $dhcp_fail = 1; } if (!$dhcp_fail and ($new['dhcp_start'] - $new['dhcp_stop'] >= 0)) { $dhcp_fail = 1; } if ($dhcp_fail) { $new['dhcp_start'] = ip2long($range[3]); $new['dhcp_stop'] = ip2long($range[4]); } $gateway = ip2long(trim($_POST['s_gateway'])); if (!isset($gateway)) { $gateway = $range[5]; } $new['gateway'] = $gateway; if ($new['hotspot']) { $new['dhcp_update_hostname'] = 0; $new['discovery'] = 0; $new['vpn'] = 0; } if ($new['vpn']) { $new['discovery'] = 0; $new['dhcp'] = 0; } if ($new['office']) { $new['free'] = 0; } if (!$new['office']) { $new['discovery'] = 0; $new['dhcp'] = 0; $new['static'] = 0; $new['dhcp_update_hostname'] = 0; $new['gateway'] = 0; $new['dhcp_start'] = 0; $new['dhcp_stop'] = 0; } update_record($db_link, "subnets", "id='$id'", $new); header("Location: " . $_SERVER["REQUEST_URI"]); exit; } unset($_POST); require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/header.php"); print_control_submenu($page_url); $sSQL = "SELECT * FROM subnets WHERE id=$id"; $subnet_info = get_record_sql($db_link, $sSQL); ?>
' . $_SESSION[$page_url]['msg'] . '
'; unset($_SESSION[$page_url]['msg']); } ?>
> \n"; ?> \n"; ?>\n"; ?> 0)) { $subnet_info['dhcp_start'] = ip2long($default_range[3]); } if (!isset($subnet_info['dhcp_stop']) or !($subnet_info['dhcp_stop'] > 0)) { $subnet_info['dhcp_stop'] = ip2long($default_range[4]); } } else { $cell_disabled = 'readonly=true'; $cl = 'down'; } print "\n"; ?> "; print_qa_select("s_dhcp", $subnet_info['dhcp']); print "\n"; ?> "; print_qa_select("s_static", $subnet_info['static']); print "\n"; $cl = 'data'; ?> \n"; ?>\n"; ?>\n"; ?>"; print_qa_select("s_office", $subnet_info['office']); print "\n"; ?> "; print_qa_select_ext("s_hotspot", $subnet_info['hotspot'], !$subnet_info['office']); print "\n"; ?> "; print_qa_select_ext("s_vpn", $subnet_info['vpn'], !$subnet_info['office']); print "\n"; ?> "; print_qa_select("s_free", $subnet_info['free']); print "\n"; ?> "; print_qa_select_ext("s_dhcp_update", $subnet_info['dhcp_update_hostname'], !$subnet_info['office']); print "\n"; ?> "; print_qa_select_ext("s_discovery", $subnet_info['discovery'], !$subnet_info['office']); print "\n"; ?>
$msg_error
\n"; } ?>