本文整理汇总了PHP中subnet_size函数的典型用法代码示例。如果您正苦于以下问题:PHP subnet_size函数的具体用法?PHP subnet_size怎么用?PHP subnet_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了subnet_size函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sprintf
$final_address_details[] = $detail_text;
}
}
} else {
if ($iprange_type == 6) {
$input_errors[] = sprintf(gettext('IPv6 address ranges are not supported (%s)'), $address_item);
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
$input_addresses[] = $address_item;
$input_address_subnet[] = "";
$final_address_details[] = $detail_text;
} else {
$subnet_type = is_subnet($address_item);
if ($_POST['type'] == "host" && $subnet_type) {
if ($subnet_type == 4) {
// For host type aliases, if the user enters an IPv4 subnet, expand it into a list of individual IPv4 addresses.
if (subnet_size($address_item) <= $max_alias_addresses - $alias_address_count) {
$rangeaddresses = subnetv4_expand($address_item);
foreach ($rangeaddresses as $rangeaddress) {
$input_addresses[] = $rangeaddress;
$input_address_subnet[] = "";
$final_address_details[] = $detail_text;
$alias_address_count++;
}
} else {
$input_errors[] = sprintf(gettext('Subnet is too large to expand into individual host IP addresses (%s)'), $address_item);
$input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses);
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
$input_addresses[] = $address_item;
$input_address_subnet[] = "";
$final_address_details[] = $detail_text;
}
开发者ID:jefersonJim,项目名称:pfsense,代码行数:31,代码来源:firewall_aliases_edit.php
示例2: do_input_validation
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) {
if ($_POST['name'] == $config['load_balancer']['virtual_server'][$i]['name'] && $i != $id) {
$input_errors[] = gettext("This virtual server name has already been used. Virtual server names must be unique.");
}
}
if (preg_match('/[ \\/]/', $_POST['name'])) {
$input_errors[] = gettext("You cannot use spaces or slashes in the 'name' field.");
}
if ($_POST['port'] != "" && !is_portoralias($_POST['port'])) {
$input_errors[] = gettext("The port must be an integer between 1 and 65535, a port alias, or left blank.");
}
if (!is_ipaddroralias($_POST['ipaddr']) && !is_subnetv4($_POST['ipaddr'])) {
$input_errors[] = sprintf(gettext("%s is not a valid IP address, IPv4 subnet, or alias."), $_POST['ipaddr']);
} else {
if (is_subnetv4($_POST['ipaddr']) && subnet_size($_POST['ipaddr']) > 64) {
$input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses."), $_POST['ipaddr']);
}
}
if (strtolower($_POST['relay_protocol']) == "dns" && !empty($_POST['sitedown'])) {
$input_errors[] = gettext("You cannot select a Fall Back Pool when using the DNS relay protocol.");
}
if (!$input_errors) {
$vsent = array();
if (isset($id) && $a_vs[$id]) {
$vsent = $a_vs[$id];
}
if ($vsent['name'] != "") {
$changedesc .= " " . sprintf(gettext("modified '%s' vs:"), $vsent['name']);
} else {
$changedesc .= " " . sprintf(gettext("created '%s' vs:"), $_POST['name']);
开发者ID:mtisza,项目名称:pfsense,代码行数:31,代码来源:load_balancer_virtual_server_edit.php
示例3: foreach
foreach ($pconfig['servers'] as $svrent) {
if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) {
$input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"enabled\" list)."), $svrent);
} else {
if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
$input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"enabled\" list)."), $svrent);
}
}
}
}
if (is_array($_POST['serversdisabled'])) {
foreach ($pconfig['serversdisabled'] as $svrent) {
if (!is_ipaddr($svrent) && !is_subnetv4($svrent)) {
$input_errors[] = sprintf(gettext("%s is not a valid IP address or IPv4 subnet (in \"disabled\" list)."), $svrent);
} else {
if (is_subnetv4($svrent) && subnet_size($svrent) > 64) {
$input_errors[] = sprintf(gettext("%s is a subnet containing more than 64 IP addresses (in \"disabled\" list)."), $svrent);
}
}
}
}
$m = array();
for ($i = 0; isset($config['load_balancer']['monitor_type'][$i]); $i++) {
$m[$config['load_balancer']['monitor_type'][$i]['name']] = $config['load_balancer']['monitor_type'][$i];
}
if (!isset($m[$_POST['monitor']])) {
$input_errors[] = gettext("Invalid monitor chosen.");
}
if (!$input_errors) {
$poolent = array();
if (isset($id) && $a_pool[$id]) {
开发者ID:nmccurdy,项目名称:pfsense,代码行数:31,代码来源:load_balancer_pool_edit.php
示例4: sprintf
$final_address_details[] = $detail_text;
}
}
} else {
if ($iprange_type == 6) {
$input_errors[] = sprintf(gettext('IPv6 address ranges are not supported (%s)'), $address_item);
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
$input_addresses[] = $address_item;
$input_address_subnet[] = "";
$final_address_details[] = $detail_text;
} else {
$subnet_type = is_subnet($address_item);
if ($_POST['type'] == "host" && $subnet_type) {
if ($subnet_type == 4) {
// For host type aliases, if the user enters an IPv4 subnet, expand it into a list of individual IPv4 addresses.
$subnet_size = subnet_size($address_item);
if ($subnet_size > 0 && $subnet_size <= $max_alias_addresses - $alias_address_count) {
$rangeaddresses = subnetv4_expand($address_item);
foreach ($rangeaddresses as $rangeaddress) {
$input_addresses[] = $rangeaddress;
$input_address_subnet[] = "";
$final_address_details[] = $detail_text;
$alias_address_count++;
}
} else {
$input_errors[] = sprintf(gettext('Subnet is too large to expand into individual host IP addresses (%s)'), $address_item);
$input_errors[] = sprintf(gettext('The maximum number of entries in an alias is %s'), $max_alias_addresses);
// Put the user-entered data in the output anyway, so it will be re-displayed for correction.
$input_addresses[] = $address_item;
$input_address_subnet[] = "";
$final_address_details[] = $detail_text;
开发者ID:curtiszimmerman,项目名称:pfsense,代码行数:31,代码来源:firewall_aliases_edit.php
注:本文中的subnet_size函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论