= 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'][$j])); 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='{$save_id}'", $new); } } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST["s_create"])) { $new_subnet = $_POST["s_create_subnet"]; if (isset($new_subnet)) { $new['subnet'] = trim($new_subnet); $range = cidrToRange($new['subnet']); $first_user_ip = $range[0]; $last_user_ip = $range[1]; $cidr = $range[2][1]; if (isset($cidr) and $cidr < 32) { $ip = $first_user_ip . '/' . $cidr; } else { $ip = $first_user_ip; } $new['ip_int_start'] = ip2long($first_user_ip); $new['ip_int_stop'] = ip2long($last_user_ip); $new['dhcp_start'] = ip2long($range[3]); $new['dhcp_stop'] = ip2long($range[4]); $new['gateway'] = ip2long($range[5]); LOG_INFO($db_link, "Create new subnet $new_subnet"); insert_record($db_link, "subnets", $new); } header("Location: " . $_SERVER["REQUEST_URI"]); } unset($_POST); require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php"); print_control_submenu($page_url); ?>