"") { $reqdfields = explode(" ", "name aliasimport"); $reqdfieldsn = explode(",", "Name,Aliases"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if (is_validaliasname($_POST['name']) == false) $input_errors[] = "The alias name may only consist of the characters a-z, A-Z, 0-9, _."; /* check for name duplicates */ if (is_alias($_POST['name'])) $input_errors[] = "An alias with this name already exists."; /* Check for reserved keyword names */ foreach($reserved_keywords as $rk) if ($rk == $_POST['name']) $input_errors[] = "Cannot use a reserved keyword as alias name $rk"; /* check for name interface description conflicts */ foreach($config['interfaces'] as $interface) { if($interface['descr'] == $_POST['name']) { $input_errors[] = "An interface description with this name already exists."; break; } } if ($_POST['aliasimport']) { $tocheck = explode("\n", $_POST['aliasimport']); $imported = array(); foreach ($tocheck as $impip) { $impip = trim($impip); if (is_iprange($impip)) { list($startip, $endip) = explode('-', $impip); $rangesubnets = ip_range_to_subnet_array($startip, $endip); $address .= implode(" ", $rangesubnets); } else if (!is_ipaddr($impip) && !is_subnet($impip) && !empty($impip)) { $input_errors[] = "$impip is not an IP address. Please correct the error to continue"; } elseif (!empty($impip)) { $imported[] = $impip; } } } if (!$input_errors && is_array($imported)) { $alias = array(); $alias['address'] = implode(" ", $imported); $alias['name'] = $_POST['name']; $alias['type'] = "network"; $alias['descr'] = $_POST['descr']; $a_aliases[] = $alias; // Sort list $a_aliases = msort($a_aliases, "name"); write_config(); pfSenseHeader("firewall_aliases.php"); exit; } } include("head.inc"); ?>