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


PHP is_ipaddrv4函数代码示例

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


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

示例1: delete_static_route

function delete_static_route($id)
{
    global $config, $a_routes, $changedesc_prefix;
    if (!isset($a_routes[$id])) {
        return;
    }
    $targets = array();
    if (is_alias($a_routes[$id]['network'])) {
        foreach (filter_expand_alias_array($a_routes[$id]['network']) as $tgt) {
            if (is_ipaddrv4($tgt)) {
                $tgt .= "/32";
            } else {
                if (is_ipaddrv6($tgt)) {
                    $tgt .= "/128";
                }
            }
            if (!is_subnet($tgt)) {
                continue;
            }
            $targets[] = $tgt;
        }
    } else {
        $targets[] = $a_routes[$id]['network'];
    }
    foreach ($targets as $tgt) {
        $family = is_subnetv6($tgt) ? "-inet6" : "-inet";
        mwexec("/sbin/route delete {$family} " . escapeshellarg($tgt));
    }
    unset($targets);
}
开发者ID:rohankapoorcom,项目名称:pfsense,代码行数:30,代码来源:system_routes.php

示例2: delete_gateway_item

/**
 * delete gateway
 * @param int $id sequence item in $a_gateways
 * @param array $a_gateways gateway list
 */
function delete_gateway_item($id, $a_gateways)
{
    global $config;
    if (!isset($a_gateways[$id])) {
        return;
    }
    /* NOTE: Cleanup static routes for the monitor ip if any */
    if (!empty($a_gateways[$id]['monitor']) && $a_gateways[$id]['monitor'] != "dynamic" && is_ipaddr($a_gateways[$id]['monitor']) && $a_gateways[$id]['gateway'] != $a_gateways[$id]['monitor']) {
        if (is_ipaddrv4($a_gateways[$id]['monitor'])) {
            mwexec("/sbin/route delete " . escapeshellarg($a_gateways[$id]['monitor']));
        } else {
            mwexec("/sbin/route delete -inet6 " . escapeshellarg($a_gateways[$id]['monitor']));
        }
    }
    if ($config['interfaces'][$a_gateways[$id]['friendlyiface']]['gateway'] == $a_gateways[$id]['name']) {
        unset($config['interfaces'][$a_gateways[$id]['friendlyiface']]['gateway']);
    }
    unset($config['gateways']['gateway_item'][$a_gateways[$id]['attribute']]);
}
开发者ID:8191,项目名称:opnsense-core,代码行数:24,代码来源:system_gateways.php

示例3: preg_split

 if ($_POST['domainsearchlist']) {
     $domain_array = preg_split("/[ ;]+/", $_POST['domainsearchlist']);
     foreach ($domain_array as $curdomain) {
         if (!is_domain($curdomain)) {
             $input_errors[] = gettext("A valid domain search list must be specified.");
             break;
         }
     }
 }
 if ($_POST['ntp1'] && !is_ipaddrv4($_POST['ntp1']) || $_POST['ntp2'] && !is_ipaddrv4($_POST['ntp2'])) {
     $input_errors[] = gettext("A valid IP address must be specified for the primary/secondary NTP servers.");
 }
 if ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp'])) {
     $input_errors[] = gettext("A valid IP address or hostname must be specified for the TFTP server.");
 }
 if ($_POST['nextserver'] && !is_ipaddrv4($_POST['nextserver'])) {
     $input_errors[] = gettext("A valid IP address must be specified for the network boot server.");
 }
 if (!$input_errors) {
     $mapent = array();
     $mapent['mac'] = $_POST['mac'];
     $mapent['cid'] = $_POST['cid'];
     $mapent['ipaddr'] = $_POST['ipaddr'];
     $mapent['hostname'] = $_POST['hostname'];
     $mapent['descr'] = $_POST['descr'];
     $mapent['arp_table_static_entry'] = $_POST['arp_table_static_entry'] ? true : false;
     $mapent['filename'] = $_POST['filename'];
     $mapent['rootpath'] = $_POST['rootpath'];
     $mapent['defaultleasetime'] = $_POST['deftime'];
     $mapent['maxleasetime'] = $_POST['maxtime'];
     unset($mapent['winsserver']);
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:services_dhcp_edit.php

示例4: explode

	unset($input_errors);
	unset($do_traceroute);

	/* input validation */
	$reqdfields = explode(" ", "host ttl");
	$reqdfieldsn = array(gettext("Host"),gettext("ttl"));
	do_input_validation($_REQUEST, $reqdfields, $reqdfieldsn, $input_errors);

	if (($_REQUEST['ttl'] < 1) || ($_REQUEST['ttl'] > MAX_TTL)) {
		$input_errors[] = sprintf(gettext("Maximum number of hops must be between 1 and %s"), MAX_TTL);
	}
	$host = trim($_REQUEST['host']);
	$ipproto = $_REQUEST['ipproto'];
	if (($ipproto == "ipv4") && is_ipaddrv6($host))
		$input_errors[] = gettext("When using IPv4, the target host must be an IPv4 address or hostname.");
	if (($ipproto == "ipv6") && is_ipaddrv4($host))
		$input_errors[] = gettext("When using IPv6, the target host must be an IPv6 address or hostname.");

	if (!$input_errors) {
		$sourceip = $_REQUEST['sourceip'];
		$do_traceroute = true;
		$ttl = $_REQUEST['ttl'];
		$resolve = $_REQUEST['resolve'];
	}
} else
	$resolve = true;

if (!isset($do_traceroute)) {
	$do_traceroute = false;
	$host = '';
	$ttl = DEFAULT_TTL;
开发者ID:nasaa0528,项目名称:core,代码行数:31,代码来源:diag_traceroute.php

示例5: Form_Input

$section->addInput(new Form_Input('domain', 'Domain', 'text', $pconfig['domain'], ['placeholder' => 'mycorp.com, home, office, private, etc.']))->setHelp('Do not use \'local\' as a domain name. It will cause local ' . 'hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve ' . 'local hosts not running mDNS.');
$form->add($section);
$section = new Form_Section('DNS Server Settings');
for ($i = 1; $i < 5; $i++) {
    //	if (!isset($pconfig['dns'.$i]))
    //		continue;
    $group = new Form_Group('DNS Server ' . $i);
    $group->add(new Form_Input('dns' . $i, 'DNS Server', 'text', $pconfig['dns' . $i]))->setHelp($i == 4 ? 'Address' : null);
    $help = "Enter IP addresses to be used by the system for DNS resolution. " . "These are also used for the DHCP service, DNS forwarder and for PPTP VPN clients.";
    if ($multiwan) {
        $options = array('none' => 'none');
        foreach ($arr_gateways as $gwname => $gwitem) {
            if (is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && is_ipaddrv6($gwitem['gateway'])) {
                continue;
            }
            if (is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && is_ipaddrv4($gwitem['gateway'])) {
                continue;
            }
            $options[$gwname] = $gwname . ' - ' . $gwitem['friendlyiface'] . ' - ' . $gwitem['gateway'];
        }
        $group->add(new Form_Select('dns' . $i . 'gw', 'Gateway', $pconfig['dns' . $i . 'gw'], $options))->setHelp($i == 4 ? 'Gateway' : null);
        $help .= '<br/>' . "In addition, optionally select the gateway for each DNS server. " . "When using multiple WAN connections there should be at least one unique DNS server per gateway.";
    }
    if ($i == 4) {
        $group->setHelp($help);
    }
    $section->add($group);
}
$section->addInput(new Form_Checkbox('dnsallowoverride', 'DNS Server Override', 'Allow DNS server list to be overridden by DHCP/PPP on WAN', $pconfig['dnsallowoverride']))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers ' . 'assigned by a DHCP/PPP server on WAN for its own purposes (including ' . 'the DNS forwarder). However, they will not be assigned to DHCP and PPTP ' . 'VPN clients.'), $g['product_name']));
$section->addInput(new Form_Checkbox('dnslocalhost', 'Disable DNS Forwarder', 'Do not use the DNS Forwarder as a DNS server for the firewall', $pconfig['dnslocalhost']))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS ' . 'server where the DNS Forwarder or DNS Resolver is enabled and set to ' . 'listen on Localhost, so system can use the local DNS service to perform ' . 'lookups. Checking this box omits localhost from the list of DNS servers.');
$form->add($section);
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:31,代码来源:system.php

示例6: array

     $reqdfieldsn = array(gettext('Shared key'));
 }
 if ($pconfig['dev_mode'] != "tap") {
     $reqdfields[] = 'tunnel_network';
     $reqdfieldsn[] = gettext('Tunnel network');
 } else {
     if ($pconfig['serverbridge_dhcp'] && $pconfig['tunnel_network']) {
         $input_errors[] = gettext("Using a tunnel network and server bridge settings together is not allowed.");
     }
     if ($pconfig['serverbridge_dhcp_start'] && !$pconfig['serverbridge_dhcp_end'] || !$pconfig['serverbridge_dhcp_start'] && $pconfig['serverbridge_dhcp_end']) {
         $input_errors[] = gettext("Server Bridge DHCP Start and End must both be empty, or defined.");
     }
     if ($pconfig['serverbridge_dhcp_start'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_start'])) {
         $input_errors[] = gettext("Server Bridge DHCP Start must be an IPv4 address.");
     }
     if ($pconfig['serverbridge_dhcp_end'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_end'])) {
         $input_errors[] = gettext("Server Bridge DHCP End must be an IPv4 address.");
     }
     if (ip2ulong($pconfig['serverbridge_dhcp_start']) > ip2ulong($pconfig['serverbridge_dhcp_end'])) {
         $input_errors[] = gettext("The Server Bridge DHCP range is invalid (start higher than end).");
     }
 }
 do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
 if (count($input_errors) == 0) {
     // validation correct, save data
     $server = array();
     // delete(rename) old interface so a new TUN or TAP interface can be created.
     if (isset($id) && $pconfig['dev_mode'] != $a_server[$id]['dev_mode']) {
         openvpn_delete('server', $a_server[$id]);
     }
     // 1 on 1 copy of config attributes
开发者ID:aya,项目名称:core,代码行数:31,代码来源:vpn_openvpn_server.php

示例7: openvpn_create_key

     $tls_mode = true;
 } else {
     $tls_mode = false;
 }
 // generate new key
 if (!empty($pconfig['autokey_enable'])) {
     $pconfig['shared_key'] = openvpn_create_key();
 }
 /* input validation */
 if (strpos($pconfig['interface'], '|') !== false) {
     list($iv_iface, $iv_ip) = explode("|", $pconfig['interface']);
 } else {
     $iv_iface = $pconfig['interface'];
     $iv_ip = null;
 }
 if (is_ipaddrv4($iv_ip) && stristr($pconfig['protocol'], "6") !== false) {
     $input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv6 protocol and an IPv4 IP address.");
 } elseif (is_ipaddrv6($iv_ip) && stristr($pconfig['protocol'], "6") === false) {
     $input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv4 protocol and an IPv6 IP address.");
 } elseif (stristr($pconfig['protocol'], "6") === false && !get_interface_ip($iv_iface) && $pconfig['interface'] != "any") {
     $input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address.");
 } elseif (stristr($pconfig['protocol'], "6") !== false && !get_interface_ipv6($iv_iface) && $pconfig['interface'] != "any") {
     $input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address.");
 }
 if (!empty($pconfig['local_port'])) {
     if (empty($pconfig['local_port']) || !is_numeric($pconfig['local_port']) || $pconfig['local_port'] < 0 || $pconfig['local_port'] > 65535) {
         $input_errors[] = "The field Local port must contain a valid port, ranging from 0 to 65535.";
     }
     $portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid);
     if ($portused != $vpnid && $portused != 0) {
         $input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
开发者ID:Anasxrt,项目名称:core,代码行数:31,代码来源:vpn_openvpn_client.php

示例8: build_carp_list

function build_carp_list()
{
    global $carplist;
    $list = array('address' => gettext('Interface Address'));
    foreach ($carplist as $vip => $address) {
        if ($gateway['ipprotocol'] == "inet" && !is_ipaddrv4($address)) {
            continue;
        }
        if ($gateway['ipprotocol'] == "inet6" && !is_ipaddrv6($address)) {
            continue;
        }
        $list[$vip] = "{$vip} - {$address}";
    }
    return $list;
}
开发者ID:littleblank,项目名称:pfsense,代码行数:15,代码来源:system_gateway_groups_edit.php

示例9: get_real_interface

 if (is_ipaddr($_POST['monitor'])) {
     $gateway['monitor'] = $_POST['monitor'];
 }
 if (isset($_POST['data_payload']) && $_POST['data_payload'] > 0) {
     $gateway['data_payload'] = $_POST['data_payload'];
 }
 /* NOTE: If gateway ip is changed need to cleanup the old static interface route */
 if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['gateway']) && $gateway['gateway'] != $a_gateway_item[$realid]['gateway'] && isset($a_gateway_item[$realid]["nonlocalgateway"])) {
     $realif = get_real_interface($a_gateway_item[$realid]['interface']);
     $inet = !is_ipaddrv4($a_gateway_item[$realid]['gateway']) ? "-inet6" : "-inet";
     $cmd = "/sbin/route delete {$inet} " . escapeshellarg($a_gateway_item[$realid]['gateway']) . " -iface " . escapeshellarg($realif);
     mwexec($cmd);
 }
 /* NOTE: If monitor ip is changed need to cleanup the old static route */
 if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['monitor']) && $_POST['monitor'] != $a_gateway_item[$realid]['monitor'] && $gateway['gateway'] != $a_gateway_item[$realid]['monitor']) {
     if (is_ipaddrv4($a_gateway_item[$realid]['monitor'])) {
         mwexec("/sbin/route delete " . escapeshellarg($a_gateway_item[$realid]['monitor']));
     } else {
         mwexec("/sbin/route delete -inet6 " . escapeshellarg($a_gateway_item[$realid]['monitor']));
     }
 }
 if ($_POST['defaultgw'] == "yes" || $_POST['defaultgw'] == "on") {
     $i = 0;
     /* remove the default gateway bits for all gateways with the same address family */
     foreach ($a_gateway_item as $gw) {
         if ($gateway['ipprotocol'] == $gw['ipprotocol']) {
             unset($config['gateways']['gateway_item'][$i]['defaultgw']);
             if ($gw['interface'] != $_POST['interface'] && $gw['defaultgw']) {
                 $reloadif = $gw['interface'];
             }
         }
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:system_gateways_edit.php

示例10: sprintf

 }
 if (is_ipaddr($pconfig['src']) && is_ipaddr($pconfig['dst'])) {
     if (!validate_address_family($pconfig['src'], $pconfig['dst'])) {
         $input_errors[] = sprintf(gettext("The Source IP address %s Address Family differs from the destination %s."), $pconfig['src'], $pconfig['dst']);
     }
     if ((is_ipaddrv6($pconfig['src']) || is_ipaddrv6($pconfig['dst'])) && $pconfig['ipprotocol'] == "inet") {
         $input_errors[] = gettext("You can not use IPv6 addresses in IPv4 rules.");
     }
     if ((is_ipaddrv4($pconfig['src']) || is_ipaddrv4($pconfig['dst'])) && $pconfig['ipprotocol'] == "inet6") {
         $input_errors[] = gettext("You can not use IPv4 addresses in IPv6 rules.");
     }
 }
 if (is_ipaddrv4($pconfig['src']) && $pconfig['srcmask'] > 32) {
     $input_errors[] = gettext("Invalid subnet mask on IPv4 source");
 }
 if (is_ipaddrv4($pconfig['dst']) && $pconfig['dstmask'] > 32) {
     $input_errors[] = gettext("Invalid subnet mask on IPv4 destination");
 }
 if ((is_ipaddr($pconfig['src']) || is_ipaddr($pconfig['dst'])) && $pconfig['ipprotocol'] == "inet46") {
     $input_errors[] = gettext("You can not use a IPv4 or IPv6 address in combined IPv4 + IPv6 rules.");
 }
 if (!empty($pconfig['os'])) {
     if ($pconfig['protocol'] != "tcp") {
         $input_errors[] = gettext("OS detection is only valid with protocol tcp.");
     }
     if (!in_array($pconfig['os'], $ostypes)) {
         $input_errors[] = gettext("Invalid OS detection selection. Please select a valid OS.");
     }
 }
 if (!empty($pconfig['floating']) && !empty($pconfig['gateway']) && (empty($pconfig['direction']) || $pconfig['direction'] == "any")) {
     $input_errors[] = gettext("You can not use gateways in Floating rules without choosing a direction.");
开发者ID:paudam,项目名称:opnsense-core,代码行数:31,代码来源:firewall_rules_edit.php

示例11: gettext

 if ($_POST['gateway'] && !is_ipaddrv6($_POST['gateway'])) {
     $input_errors[] = gettext("A valid IPv6 address must be specified for the gateway.");
 }
 if ($_POST['dns1'] && !is_ipaddrv6($_POST['dns1']) || $_POST['dns2'] && !is_ipaddrv6($_POST['dns2']) || $_POST['dns3'] && !is_ipaddrv6($_POST['dns3']) || $_POST['dns4'] && !is_ipaddrv6($_POST['dns4'])) {
     $input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
 }
 if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || $_POST['deftime'] < 60)) {
     $input_errors[] = gettext("The default lease time must be at least 60 seconds.");
 }
 if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || $_POST['maxtime'] < 60 || $_POST['maxtime'] <= $_POST['deftime'])) {
     $input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
 }
 if ($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])) {
     $input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
 }
 if ($_POST['ddnsdomain'] && !is_ipaddrv4($_POST['ddnsdomainprimary'])) {
     $input_errors[] = gettext("A valid primary domain name server IPv4 address must be specified for the dynamic domain name.");
 }
 if ($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname'] || $_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey']) {
     $input_errors[] = gettext("You must specify both a valid domain key and key name.");
 }
 if ($_POST['domainsearchlist']) {
     $domain_array = preg_split("/[ ;]+/", $_POST['domainsearchlist']);
     foreach ($domain_array as $curdomain) {
         if (!is_domain($curdomain)) {
             $input_errors[] = gettext("A valid domain search list must be specified.");
             break;
         }
     }
 }
 if ($_POST['ntp1'] && !is_ipaddrv6($_POST['ntp1']) || $_POST['ntp2'] && !is_ipaddrv6($_POST['ntp2'])) {
开发者ID:dariomas,项目名称:pfsense,代码行数:31,代码来源:services_dhcpv6.php

示例12: escapeshellarg

			}
			//]]>
			</script>
		<?php 
    echo "<textarea id=\"testportCaptured\" style=\"width:98%\" name=\"code\" rows=\"15\" cols=\"66\" readonly=\"readonly\">";
    $result = "";
    $nc_base_cmd = "/usr/bin/nc";
    $nc_args = "-w " . escapeshellarg($timeout);
    if (!$showtext) {
        $nc_args .= " -z ";
    }
    if (!empty($srcport)) {
        $nc_args .= " -p " . escapeshellarg($srcport) . " ";
    }
    /* Attempt to determine the interface address, if possible. Else try both. */
    if (is_ipaddrv4($host)) {
        $ifaddr = $sourceip == "any" ? "" : get_interface_ip($sourceip);
        $nc_args .= " -4";
    } elseif (is_ipaddrv6($host)) {
        if ($sourceip == "any") {
            $ifaddr = "";
        } else {
            if (is_linklocal($sourceip)) {
                $ifaddr = $sourceip;
            } else {
                $ifaddr = get_interface_ipv6($sourceip);
            }
        }
        $nc_args .= " -6";
    } else {
        switch ($ipprotocol) {
开发者ID:mtisza,项目名称:pfsense,代码行数:31,代码来源:diag_testport.php

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

示例14: substr

         $hostname = "";
     }
     $src_icons = "";
     $dst_icons = $alert_ip . "&nbsp;" . $supp_ip . "&nbsp;";
 }
 // Determine Country Code of Host
 if (is_ipaddrv4($host)) {
     $country = substr(exec("{$pathgeoip} -f {$pathgeoipdat} {$host}"), 23, 2);
 } else {
     $country = substr(exec("{$pathgeoip6} -f {$pathgeoipdat6} {$host}"), 26, 2);
 }
 // IP Query Grep Exclusion
 $pfb_ex1 = "grep -v 'pfB\\_\\|\\_v6\\.txt'";
 $pfb_ex2 = "grep -v 'pfB\\_\\|/32\\|/24\\|\\_v6\\.txt' | grep -m1 '/'";
 // Find List which contains Blocked IP Host
 if (is_ipaddrv4($host) && $pfb_query != "Country") {
     // Search for exact IP Match
     $host1 = preg_replace("/(\\d{1,3})\\.(\\d{1,3}).(\\d{1,3}).(\\d{1,3})/", '\'$1\\.$2\\.$3\\.$4\'', $host);
     $pfb_query = exec("/usr/bin/grep -rHm1 {$host1} {$pfbfolder} | sed -e 's/^.*[a-zA-Z]\\///' -e 's/:.*//' -e 's/\\..*/ /' | {$pfb_ex1}");
     // Search for IP in /24 CIDR
     if (empty($pfb_query)) {
         $host1 = preg_replace("/(\\d{1,3})\\.(\\d{1,3}).(\\d{1,3}).(\\d{1,3})/", '\'$1\\.$2\\.$3\\.0/24\'', $host);
         $pfb_query = exec("/usr/bin/grep -rHm1 {$host1} {$pfbfolder} | sed -e 's/^.*[a-zA-Z]\\///' -e 's/\\.txt:/ /' | {$pfb_ex1}");
     }
     // Search for First Two IP Octets in CIDR Matches Only. Skip any pfB (Country Lists) or /32,/24 Addresses.
     if (empty($pfb_query)) {
         $host1 = preg_replace("/(\\d{1,3})\\.(\\d{1,3}).(\\d{1,3}).(\\d{1,3})/", '\'^$1\\.$2\\.\'', $host);
         $pfb_query = exec("/usr/bin/grep -rH {$host1} {$pfbfolder} | sed -e 's/^.*[a-zA-Z]\\///' -e 's/\\.txt:/ /' | {$pfb_ex2}");
     }
     // Search for First Two IP Octets in CIDR Matches Only (Subtract 1 from second Octet on each loop).
     // Skip (Country Lists) or /32,/24 Addresses.
开发者ID:randyqx,项目名称:pfsense-packages,代码行数:31,代码来源:pfblockerng_alerts.php

示例15: gettext

									</tr>
									<tr>
										<td width="22%" valign="top" class="vncell"><?php 
echo gettext("IPv4 Upstream Gateway");
?>
</td>
										<td width="78%" class="vtable">
											<select name="gateway" class="formselect" id="gateway">
												<option value="none" selected="selected"><?php 
echo gettext("None");
?>
</option>
												<?php 
if (count($a_gateways) > 0) {
    foreach ($a_gateways as $gateway) {
        if ($gateway['interface'] == $if && is_ipaddrv4($gateway['gateway'])) {
            ?>
														<option value="<?php 
            echo $gateway['name'];
            ?>
" <?php 
            if ($gateway['name'] == $pconfig['gateway']) {
                echo "selected=\"selected\"";
            }
            ?>
>
															<?php 
            echo htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']);
            ?>
														</option>
												<?php 
开发者ID:nmccurdy,项目名称:pfsense,代码行数:31,代码来源:interfaces.php


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