当前位置: 首页>>代码示例>>PHP>>正文


PHP is_subnetv4函数代码示例

本文整理汇总了PHP中is_subnetv4函数的典型用法代码示例。如果您正苦于以下问题:PHP is_subnetv4函数的具体用法?PHP is_subnetv4怎么用?PHP is_subnetv4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_subnetv4函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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

示例3: foreach

if (empty($suricatacfg['libhtp_policy']['item'])) {
    $http_hosts_default_policy = "default-config:\n     personality: IDS\n     request-body-limit: 4096\n     response-body-limit: 4096\n";
    $http_hosts_default_policy .= "     double-decode-path: no\n     double-decode-query: no\n     uri-include-all: no\n";
} else {
    foreach ($suricatacfg['libhtp_policy']['item'] as $k => $v) {
        if ($v['bind_to'] != "all") {
            $engine = "server-config:\n     - {$v['name']}:\n";
            $tmp = trim(filter_expand_alias($v['bind_to']));
            if (!empty($tmp)) {
                $engine .= "         address: [";
                $tmp = preg_replace('/\\s+/', ',', $tmp);
                $list = explode(',', $tmp);
                foreach ($list as $addr) {
                    if (is_ipaddrv6($addr) || is_subnetv6($addr)) {
                        $engine .= "\"{$addr}\", ";
                    } elseif (is_ipaddrv4($addr) || is_subnetv4($addr)) {
                        $engine .= "{$addr}, ";
                    } else {
                        log_error("[suricata] WARNING: invalid IP address value '{$addr}' in Alias {$v['bind_to']} will be ignored.");
                        continue;
                    }
                }
                $engine = trim($engine, ' ,');
                $engine .= "]\n";
                $engine .= "         personality: {$v['personality']}\n         request-body-limit: {$v['request-body-limit']}\n";
                $engine .= "         response-body-limit: {$v['response-body-limit']}\n";
                $engine .= "         double-decode-path: {$v['double-decode-path']}\n";
                $engine .= "         double-decode-query: {$v['double-decode-query']}\n";
                $engine .= "         uri-include-all: {$v['uri-include-all']}\n";
                $http_hosts_policy .= "   {$engine}\n";
            } else {
开发者ID:MarkVLK,项目名称:pfsense-packages,代码行数:31,代码来源:suricata_generate_yaml.php


注:本文中的is_subnetv4函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。