• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_ipaddrv6函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了is_ipaddrv6函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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:nmccurdy,项目名称:pfsense,代码行数:30,代码来源:system_routes.php


示例2: find_ip_interface

function find_ip_interface($ip, $bits = null)
{
    if (!is_ipaddr($ip)) {
        return false;
    }
    $isv6ip = is_ipaddrv6($ip);
    /* if list */
    $ifdescrs = get_configured_interface_list();
    foreach ($ifdescrs as $ifdescr => $ifname) {
        $ifip = $isv6ip ? get_interface_ipv6($ifname) : get_interface_ip($ifname);
        if (is_null($ifip)) {
            continue;
        }
        if (is_null($bits)) {
            if ($ip == $ifip) {
                $int = get_real_interface($ifname);
                return $int;
            }
        } else {
            if (ip_in_subnet($ifip, $ip . "/" . $bits)) {
                $int = get_real_interface($ifname);
                return $int;
            }
        }
    }
    return false;
}
开发者ID:noikiy,项目名称:core-2,代码行数:27,代码来源:wizard.php


示例3: build_gatewayv6_list

function build_gatewayv6_list()
{
    global $a_gateways, $if;
    $list = array("none" => "None");
    foreach ($a_gateways as $gateway) {
        if ($gateway['interface'] == $if && is_ipaddrv6($gateway['gateway'])) {
            $list[$gateway['name']] = $gateway['name'] . " - " . $gateway['gateway'];
        }
    }
    return $list;
}
开发者ID:simudream,项目名称:pfsense,代码行数:11,代码来源:interfaces.php


示例4: unset

            break;
        }
    }
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    /* input validation */
    if ($_POST['enable']) {
        $reqdfields = explode(" ", "server interface");
        $reqdfieldsn = array(gettext("Destination Server"), gettext("Interface"));
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
        $svrlist = '';
        if ($_POST['server']) {
            foreach ($_POST['server'] as $checksrv => $srv) {
                if (!is_ipaddrv6($srv[0])) {
                    $input_errors[] = gettext("A valid Destination Server IPv6 address must be specified.");
                }
                if (!empty($srv[0])) {
                    // Filter out any empties
                    if (!empty($svrlist)) {
                        $svrlist .= ',';
                    }
                    $svrlist .= $srv[0];
                }
            }
        }
    }
    if (!$input_errors) {
        $config['dhcrelay6']['enable'] = $_POST['enable'] ? true : false;
        $config['dhcrelay6']['interface'] = implode(",", $_POST['interface']);
开发者ID:hexaclock,项目名称:pfsense,代码行数:31,代码来源:services_dhcpv6_relay.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: openvpn_create_key

 } else {
     $tls_mode = false;
 }
 if (!empty($pconfig['autokey_enable'])) {
     $pconfig['shared_key'] = openvpn_create_key();
 }
 // all input validators
 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['authmode']) && ($pconfig['mode'] == "server_user" || $pconfig['mode'] == "server_tls_user")) {
     $input_errors[] = gettext("You must select a Backend for Authentication if the server mode requires User Auth.");
 }
 if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port')) {
     $input_errors[] = $result;
 }
 if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4")) {
     $input_errors[] = $result;
 }
开发者ID:aya,项目名称:core,代码行数:31,代码来源:vpn_openvpn_server.php


示例7: gettext

     if ($_POST['interface'] == 'lo0') {
         $input_errors[] = gettext("For this type of vip localhost is not allowed.");
     } else {
         if (strpos($_POST['interface'], '_vip')) {
             $input_errors[] = gettext("A CARP parent interface can only be used with IP Alias type Virtual IPs.");
         }
     }
     break;
 case 'ipalias':
     if (strstr($_POST['interface'], "_vip")) {
         if (is_ipaddrv4($_POST['subnet'])) {
             $parent_ip = get_interface_ip($_POST['interface']);
             $parent_sn = get_interface_subnet($_POST['interface']);
             $subnet = gen_subnet($parent_ip, $parent_sn);
         } else {
             if (is_ipaddrv6($_POST['subnet'])) {
                 $parent_ip = get_interface_ipv6($_POST['interface']);
                 $parent_sn = get_interface_subnetv6($_POST['interface']);
                 $subnet = gen_subnetv6($parent_ip, $parent_sn);
             }
         }
         if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") && !ip_in_interface_alias_subnet(link_carp_interface_to_parent($_POST['interface']), $_POST['subnet'])) {
             $cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'];
             $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s.  Please add an IP alias in this subnet on this interface."), $cannot_find);
         }
         unset($parent_ip, $parent_sn, $subnet);
     }
     break;
 default:
     if ($_POST['interface'] == 'lo0') {
         $input_errors[] = gettext("For this type of vip localhost is not allowed.");
开发者ID:toshisam,项目名称:pfsense,代码行数:31,代码来源:firewall_virtual_ip_edit.php


示例8: array

if (isset($cpzone) && !empty($cpzone) && isset($a_cp[$cpzone]['zoneid'])) {
    $cpzoneid = $a_cp[$cpzone]['zoneid'];
}
$pgtitle = array(gettext("Services"), gettext("Captive Portal"), "Zone " . $a_cp[$cpzone]['zone'], gettext("Allowed Hostnames"));
$shortcut_section = "captiveportal";
if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) {
    $a_allowedhostnames =& $a_cp[$cpzone]['allowedhostname'];
    if ($a_allowedhostnames[$_GET['id']]) {
        $ipent = $a_allowedhostnames[$_GET['id']];
        if (isset($a_cp[$cpzone]['enable'])) {
            if (is_ipaddr($ipent['hostname'])) {
                $ip = $ipent['hostname'];
            } else {
                $ip = gethostbyname($ipent['hostname']);
            }
            $sn = is_ipaddrv6($ip) ? 128 : 32;
            if (is_ipaddr($ip)) {
                $ipfw = pfSense_ipfw_getTablestats($cpzoneid, IP_FW_TABLE_XLISTENTRY, 3, $ip);
                if (is_array($ipfw)) {
                    captiveportal_free_dn_ruleno($ipfw['dnpipe']);
                    pfSense_pipe_action("pipe delete {$ipfw['dnpipe']}");
                    pfSense_pipe_action("pipe delete " . ($ipfw['dnpipe'] + 1));
                }
                pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 3, $ip, $sn);
                pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 4, $ip, $sn);
            }
        }
        unset($a_allowedhostnames[$_GET['id']]);
        write_config();
        captiveportal_allowedhostname_configure();
        header("Location: services_captiveportal_hostname.php?zone={$cpzone}");
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:services_captiveportal_hostname.php


示例9: gettext

     $reqdfieldsn[] = gettext("Remote gateway");
 }
 do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
 if (isset($validate_pskey) && isset($pconfig['pskey']) && !preg_match('/^[[:ascii:]]*$/', $pconfig['pskey'])) {
     unset($validate_pskey);
     $input_errors[] = gettext("Pre-Shared Key contains invalid characters.");
 }
 if ($pconfig['lifetime'] && !is_numericint($pconfig['lifetime'])) {
     $input_errors[] = gettext("The P1 lifetime must be an integer.");
 }
 if ($pconfig['remotegw']) {
     if (!is_ipaddr($pconfig['remotegw']) && !is_domain($pconfig['remotegw'])) {
         $input_errors[] = gettext("A valid remote gateway address or host name must be specified.");
     } elseif (is_ipaddrv4($pconfig['remotegw']) && $pconfig['protocol'] != "inet") {
         $input_errors[] = gettext("A valid remote gateway IPv4 address must be specified or protocol needs to be changed to IPv6");
     } elseif (is_ipaddrv6($pconfig['remotegw']) && $pconfig['protocol'] != "inet6") {
         $input_errors[] = gettext("A valid remote gateway IPv6 address must be specified or protocol needs to be changed to IPv4");
     }
 }
 if ($pconfig['remotegw'] && is_ipaddr($pconfig['remotegw']) && !isset($pconfig['disabled'])) {
     $t = 0;
     foreach ($a_phase1 as $ph1tmp) {
         if ($p1index != $t) {
             $tremotegw = $pconfig['remotegw'];
             if ($ph1tmp['remote-gateway'] == $tremotegw && !isset($ph1tmp['disabled'])) {
                 $input_errors[] = sprintf(gettext('The remote gateway "%1$s" is already used by phase1 "%2$s".'), $tremotegw, $ph1tmp['descr']);
             }
         }
         $t++;
     }
 }
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:31,代码来源:vpn_ipsec_phase1.php


示例10: switch

                 break;
         }
     }
     switch ($pconfig['remoteid_type']) {
         case "network":
             if ($pconfig['remoteid_netbits'] != 0 && !$pconfig['remoteid_netbits'] || !is_numeric($pconfig['remoteid_netbits'])) {
                 $input_errors[] = gettext("A valid remote network bit count must be specified.");
             }
             // address rules also apply to network type (hence, no break)
         // address rules also apply to network type (hence, no break)
         case "address":
             if (!$pconfig['remoteid_address'] || !is_ipaddr($pconfig['remoteid_address'])) {
                 $input_errors[] = gettext("A valid remote network IP address must be specified.");
             } elseif (is_ipaddrv4($pconfig['remoteid_address']) && $pconfig['mode'] != "tunnel") {
                 $input_errors[] = gettext("A valid remote network IPv4 address must be specified or you need to change Mode to IPv6");
             } elseif (is_ipaddrv6($pconfig['remoteid_address']) && $pconfig['mode'] != "tunnel6") {
                 $input_errors[] = gettext("A valid remote network IPv6 address must be specified or you need to change Mode to IPv4");
             }
             break;
     }
 }
 /* Validate enabled phase2's are not duplicates */
 if (isset($pconfig['mobile'])) {
     /* User is adding phase 2 for mobile phase1 */
     foreach ($config['ipsec']['phase2'] as $key => $name) {
         if (isset($name['mobile']) && $name['uniqid'] != $pconfig['uniqid']) {
             /* check duplicate localids only for mobile clents */
             $localid_data = ipsec_idinfo_to_cidr($name['localid'], false, $name['mode']);
             $entered = array();
             $entered['type'] = $pconfig['localid_type'];
             if (isset($pconfig['localid_address'])) {
开发者ID:noikiy,项目名称:core-2,代码行数:31,代码来源:vpn_ipsec_phase2.php


示例11: gettext

 if (!is_ipaddr($_POST['tunnel-local-addr']) || !is_ipaddr($_POST['tunnel-remote-addr']) || !is_ipaddr($_POST['remote-addr'])) {
     $input_errors[] = gettext("The tunnel local and tunnel remote fields must have valid IP addresses.");
 }
 if (!is_numericint($_POST['tunnel-remote-net'])) {
     $input_errors[] = gettext("The GRE tunnel subnet must be an integer.");
 }
 if (is_ipaddrv4($_POST['tunnel-local-addr'])) {
     if (!is_ipaddrv4($_POST['tunnel-remote-addr'])) {
         $input_errors[] = gettext("The GRE Tunnel remote address must be IPv4 where tunnel local address is IPv4.");
     }
     if ($_POST['tunnel-remote-net'] > 32 || $_POST['tunnel-remote-net'] < 1) {
         $input_errors[] = gettext("The GRE tunnel subnet must be an integer between 1 and 32.");
     }
 }
 if (is_ipaddrv6($_POST['tunnel-local-addr'])) {
     if (!is_ipaddrv6($_POST['tunnel-remote-addr'])) {
         $input_errors[] = gettext("The GRE Tunnel remote address must be IPv6 where tunnel local address is IPv6.");
     }
     if ($_POST['tunnel-remote-net'] > 128 || $_POST['tunnel-remote-net'] < 1) {
         $input_errors[] = gettext("The GRE tunnel subnet must be an integer between 1 and 128.");
     }
 }
 foreach ($a_gres as $gre) {
     if (isset($id) && $a_gres[$id] && $a_gres[$id] === $gre) {
         continue;
     }
     if ($gre['if'] == $_POST['if'] && $gre['tunnel-remote-addr'] == $_POST['tunnel-remote-addr']) {
         $input_errors[] = sprintf(gettext("A GRE tunnel with the network %s is already defined."), $gre['remote-network']);
         break;
     }
 }
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:31,代码来源:interfaces_gre_edit.php


示例12: unset

    }
}
if ($_POST) {
    unset($input_errors);
    if ($_POST['server']) {
        $_POST['server'] = filterDestinationServers($_POST['server']);
    }
    $pconfig = $_POST;
    /* input validation */
    if ($_POST['enable']) {
        $reqdfields = explode(" ", "server interface");
        $reqdfieldsn = array(gettext("Destination Server"), gettext("Interface"));
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
        if ($_POST['server']) {
            foreach ($_POST['server'] as $srv) {
                if (!is_ipaddrv6($srv)) {
                    $input_errors[] = gettext("A valid Destination Server IPv6 address  must be specified.");
                }
            }
        }
    }
    if (!$input_errors) {
        $config['dhcrelay6']['enable'] = $_POST['enable'] ? true : false;
        $config['dhcrelay6']['interface'] = implode(",", $_POST['interface']);
        $config['dhcrelay6']['agentoption'] = $_POST['agentoption'] ? true : false;
        $config['dhcrelay6']['server'] = $_POST['server'];
        write_config();
        $retval = 0;
        $retval = services_dhcrelay6_configure();
        $savemsg = get_std_save_message($retval);
    }
开发者ID:ffdesousa,项目名称:pfsense,代码行数:31,代码来源:services_dhcpv6_relay.php


示例13: printf

							                          <strong><?php 
    printf(gettext("Enable DHCPv6 relay on interface"));
    ?>
</strong>
										</td>
									</tr>
									<tr>
                                      <td width="22%" valign="top" class="vncellreq"><?php 
    echo gettext('Interface(s)');
    ?>
</td>
							                        <td width="78%" class="vtable">
											<select id="interface" name="interface[]" multiple="multiple" class="formselect" size="3">
										<?php 
    foreach ($iflist as $ifent => $ifdesc) {
        if (!is_ipaddrv6(get_interface_ipv6($ifent))) {
            continue;
        }
        echo "<option value=\"{$ifent}\"";
        if (!empty($pconfig['interface']) && in_array($ifent, $pconfig['interface'])) {
            echo " selected=\"selected\"";
        }
        echo ">{$ifdesc}</option>\n";
    }
    ?>
							                                </select>
											<br /><?php 
    echo gettext("Interfaces without an IPv6 address will not be shown.");
    ?>
										</td>
									</tr>
开发者ID:noikiy,项目名称:core-2,代码行数:31,代码来源:services_dhcpv6_relay.php


示例14: gettext

    echo $selected_key == "address" ? "selected=\"selected\"" : "";
    ?>
 >
                                <?php 
    echo gettext("Interface Address");
    ?>
                              </option>
<?php 
    foreach (get_configured_carp_interface_list() as $vip => $address) {
        if (!preg_match("/^{$gateway['friendlyiface']}_/i", $vip)) {
            continue;
        }
        if ($gateway['ipprotocol'] == "inet" && !is_ipaddrv4($address)) {
            continue;
        }
        if ($gateway['ipprotocol'] == "inet6" && !is_ipaddrv6($address)) {
            continue;
        }
        ?>
                                  <option value="<?php 
        echo $vip;
        ?>
" <?php 
        echo $selected_key == $vip ? "selected=\"selected\"" : "";
        ?>
 >
                                    <?php 
        echo $vip;
        ?>
 - <?php 
        echo $address;
开发者ID:noikiy,项目名称:core-2,代码行数:31,代码来源:system_gateway_groups_edit.php


示例15: gettext

 }
 if (isset($_POST['data_payload']) && is_numeric($_POST['data_payload']) && $_POST['data_payload'] < 0) {
     $input_errors[] = gettext("A valid data payload must be specified.");
 }
 /* only allow correct IPv4 and IPv6 gateway addresses */
 if ($_POST['gateway'] != "" && is_ipaddr($_POST['gateway']) && $_POST['gateway'] != "dynamic") {
     if (is_ipaddrv6($_POST['gateway']) && $_POST['ipprotocol'] == "inet") {
         $input_errors[] = sprintf(gettext("The IPv6 gateway address '%s' can not be used as a IPv4 gateway."), $_POST['gateway']);
     }
     if (is_ipaddrv4($_POST['gateway']) && $_POST['ipprotocol'] == "inet6") {
         $input_errors[] = sprintf(gettext("The IPv4 gateway address '%s' can not be used as a IPv6 gateway."), $_POST['gateway']);
     }
 }
 /* only allow correct IPv4 and IPv6 monitor addresses */
 if ($_POST['monitor'] != "" && is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") {
     if (is_ipaddrv6($_POST['monitor']) && $_POST['ipprotocol'] == "inet") {
         $input_errors[] = sprintf(gettext("The IPv6 monitor address '%s' can not be used on a IPv4 gateway."), $_POST['monitor']);
     }
     if (is_ipaddrv4($_POST['monitor']) && $_POST['ipprotocol'] == "inet6") {
         $input_errors[] = sprintf(gettext("The IPv4 monitor address '%s' can not be used on a IPv6 gateway."), $_POST['monitor']);
     }
 }
 if (isset($_POST['name'])) {
     /* check for overlaps */
     foreach ($a_gateways as $gateway) {
         if (isset($id) && $a_gateways[$id] && $a_gateways[$id] === $gateway) {
             if ($gateway['name'] != $_POST['name']) {
                 $input_errors[] = gettext("Changing name on a gateway is not allowed.");
             }
             continue;
         }
开发者ID:nwholloway,项目名称:pfsense,代码行数:31,代码来源:system_gateways_edit.php


示例16: array

require_once "auth.inc";
include 'head.inc';
$ous = array();
if (isset($_GET['basedn']) && isset($_GET['host'])) {
    if (isset($_GET['cert'])) {
        $authcfg = array();
        $authcfg['ldap_caref'] = $_GET['cert'];
        ldap_setup_caenv($authcfg);
    }
    $ldap_authcn = isset($_GET['authcn']) ? explode(";", $_GET['authcn']) : array();
    if (isset($_GET['urltype']) && strstr($_GET['urltype'], "Standard")) {
        $ldap_full_url = "ldap://";
    } else {
        $ldap_full_url = "ldaps://";
    }
    $ldap_full_url .= is_ipaddrv6($_GET['host']) ? "[{$_GET['host']}]" : $_GET['host'];
    if (!empty($_GET['port'])) {
        $ldap_full_url .= ":{$_GET['port']}";
    }
    $ldap_auth = new OPNsense\Auth\LDAP($_GET['basedn'], isset($_GET['proto']) ? $_GET['proto'] : 3);
    $ldap_is_connected = $ldap_auth->connect($ldap_full_url, !empty($_GET['binddn']) ? $_GET['binddn'] : null, !empty($_GET['bindpw']) ? $_GET['bindpw'] : null);
    if ($ldap_is_connected) {
        $ous = $ldap_auth->listOUs();
    }
}
?>

 <body>
	<script type="text/javascript">
function post_choices() {
开发者ID:8191,项目名称:opnsense-core,代码行数:30,代码来源:system_usermanager_settings_ldapacpicker.php


示例17: array

 for ($x = 0; $x < 50; $x++) {
     if (isset($pconfig["acl_network{$x}"])) {
         $networkacl[$x] = array();
         $networkacl[$x]['acl_network'] = $pconfig["acl_network{$x}"];
         $networkacl[$x]['mask'] = $pconfig["mask{$x}"];
         $networkacl[$x]['description'] = $pconfig["description{$x}"];
         if (!is_ipaddr($networkacl[$x]['acl_network'])) {
             $input_errors[] = gettext("You must enter a valid IP address for each row under Networks.");
         }
         if (is_ipaddr($networkacl[$x]['acl_network'])) {
             if (!is_subnet($networkacl[$x]['acl_network'] . "/" . $networkacl[$x]['mask'])) {
                 $input_errors[] = gettext("You must enter a valid IPv4 netmask for each IPv4 row under Networks.");
             }
         } else {
             if (function_exists("is_ipaddrv6")) {
                 if (!is_ipaddrv6($networkacl[$x]['acl_network'])) {
                     $input_errors[] = gettext("You must enter a valid IPv6 address for {$networkacl[$x]['acl_network']}.");
                 } else {
                     if (!is_subnetv6($networkacl[$x]['acl_network'] . "/" . $networkacl[$x]['mask'])) {
                         $input_errors[] = gettext("You must enter a valid IPv6 netmask for each IPv6 row under Networks.");
                     }
                 }
             } else {
                 $input_errors[] = gettext("You must enter a valid IP address for each row under Networks.");
             }
         }
     } else {
         if (isset($networkacl[$x])) {
             unset($networkacl[$x]);
         }
     }
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:services_unbound_acls.php


示例18: define

require_once "guiconfig.inc";
define('MAX_COUNT', 10);
define('DEFAULT_COUNT', 3);
if ($_POST || $_REQUEST['host']) {
    unset($input_errors);
    unset($do_ping);
    /* input validation */
    $reqdfields = explode(" ", "host count");
    $reqdfieldsn = array(gettext("Host"), gettext("Count"));
    do_input_validation($_REQUEST, $reqdfields, $reqdfieldsn, $input_errors);
    if ($_REQUEST['count'] < 1 || $_REQUEST['count'] > MAX_COUNT) {
        $input_errors[] = sprintf(gettext("Count must be between 1 and %s"), MAX_COUNT);
    }
    $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) {
        $do_ping = true;
        $sourceip = $_REQUEST['sourceip'];
        $count = $_POST['count'];
        if (preg_match('/[^0-9]/', $count)) {
            $count = DEFAULT_COUNT;
        }
    }
}
if (!isset($do_ping)) {
开发者ID:OptimWIFI,项目名称:pfsense,代码行数:31,代码来源:diag_ping.php


示例19: gethostbyname

    return $resolved;
}
if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) {
    $resolved = gethostbyname($host);
    $type = "hostname";
    if ($resolved) {
        $resolved = resolve_host_addresses($host);
        $isfirst = true;
        foreach ($resolved as $re) {
            if ($re['data'] != "") {
                if (!$isfirst) {
                    $addresses .= " ";
                }
                $re = rtrim($re['data']);
                if (is_ipaddr($re)) {
                    $sn = is_ipaddrv6($re) ? '/128' : '/32';
                } else {
                    // The name was a CNAME and resolved to another name, rather than an address.
                    // In this case the alias entry will have a FQDN, so do not put a CIDR after it.
                    $sn = "";
                }
                $addresses .= $re . $sn;
                $isfirst = false;
            }
        }
        $newalias = array();
        $newalias['name'] = $aliasname;
        $newalias['type'] = "network";
        $newalias['address'] = $addresses;
        $newalias['descr'] = gettext("Created from Diagnostics-> DNS Lookup");
        if ($alias_exists) {
开发者ID:NewEraCracker,项目名称:pfsense,代码行数:31,代码来源:diag_dns.php


示例20: display_top_tabs

}
display_top_tabs($tab_array);
$tab_array = array();
$tab_array[] = array(gettext("DHCPv6 Server"), false, "services_dhcpv6.php?if={$if}");
$tab_array[] = array(gettext("Router Advertisements"), true, "services_router_advertisements.php?if={$if}");
display_top_tabs($tab_array, false, 'nav nav-tabs');
$form = new Form(new Form_Button('Submit', gettext("Save")));
$section = new Form_Section('Advertisements');
$section->addInput(new Form_Select('ramode', 'Router mode', $pconfig['ramode'], $advertise_modes))->setHelp('Select the Operating Mode for the Router Advertisement (RA) Daemon. Use:' . '<br />' . '&nbsp;<strong>Router Only</strong> to only advertise this router' . '<br />' . '&nbsp;<strong>Unmanaged</strong> for Router Advertising with Stateless Autoconfig' . '<br />' . '&nbsp;<strong>Managed</strong> for assignment through a DHCPv6 Server' . '<br />' . '&nbsp;<strong>Assisted</strong> for DHCPv6 Server assignment combined with Stateless Autoconfig.' . 'It is not required to activate this DHCPv6 server when set to "Managed", this can be another host on the network');
$section->addInput(new Form_Select('rapriority', 'Router priority', $pconfig['rapriority'], $priority_modes))->setHelp('Select the Priority for the Router Advertisement (RA) Daemon.');
$section->addInput(new Form_Input('ravalidlifetime', 'Default valid lifetime', 'text', $pconfig['ravalidlifetime']))->setHelp('Seconds. The length of time in seconds (relative to the time the packet is sent) that the prefix is valid for the purpose of on-link determination.' . ' <br />' . 'The default is 86400 seconds.');
$section->addInput(new Form_Input('rapreferredlifetime', 'Default preferred lifetime', 'text', $pconfig['rapreferredlifetime']))->setHelp('Seconds. The length of time in seconds (relative to the time the packet is sent) that addresses generated from the prefix via stateless address autoconfiguration remain preferred.' . ' <br />' . 'The default is 14400 seconds.');
$carplistif = array();
if (count($carplist) > 0) {
    foreach ($carplist as $ifname => $vip) {
        if (preg_match("/^{$if}_/", $ifname) && is_ipaddrv6($vip)) {
            $carplistif[$ifname] = $vip;
        }
    }
}
if (count($carplistif) > 0) {
    $list = array();
    foreach ($carplistif as $ifname => $vip) {
        $list['interface'] = strtoupper($if);
        $list[$ifname] = $ifname . ' - ' . $vip;
    }
    $section->addInput(new Form_Select('rainterface', 'RA Interface', $pconfig['rainterface'], $list))->setHelp('Select the Interface for the Router Advertisement (RA) Daemon.');
}
$section->addInput(new Form_StaticText('RA Subnets', $subnets_help));
if (empty($pconfig['subnets'])) {
    $pconfig['subnets'] = array('0' => '/128');
开发者ID:hexaclock,项目名称:pfsense,代码行数:31,代码来源:services_router_advertisements.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_iprange函数代码示例发布时间:2022-05-15
下一篇:
PHP is_ipaddrv4函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap