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

PHP get_interface_ip函数代码示例

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

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



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

示例1: getNasIP

 function getNasIP()
 {
     $nasIp = get_interface_ip();
     if (!$nasIp) {
         $nasIp = "0.0.0.0";
     }
     return $nasIp;
 }
开发者ID:toshisam,项目名称:pfsense,代码行数:8,代码来源:openvpn.auth-user.php


示例2: deleteVIPEntry

/**
 * delete virtual ip
 */
function deleteVIPEntry($id)
{
    global $config;
    $input_errors = array();
    $a_vip =& $config['virtualip']['vip'];
    /* make sure no inbound NAT mappings reference this entry */
    if (isset($config['nat']['rule'])) {
        foreach ($config['nat']['rule'] as $rule) {
            if (!empty($rule['destination']['address'])) {
                if ($rule['destination']['address'] == $a_vip[$id]['subnet']) {
                    $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one NAT mapping.");
                    break;
                }
            }
        }
    }
    if (is_ipaddrv6($a_vip[$id]['subnet'])) {
        $is_ipv6 = true;
        $subnet = gen_subnetv6($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']);
        $if_subnet_bits = get_interface_subnetv6($a_vip[$id]['interface']);
        $if_subnet = gen_subnetv6(get_interface_ipv6($a_vip[$id]['interface']), $if_subnet_bits);
    } else {
        $is_ipv6 = false;
        $subnet = gen_subnet($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']);
        $if_subnet_bits = get_interface_subnet($a_vip[$id]['interface']);
        $if_subnet = gen_subnet(get_interface_ip($a_vip[$id]['interface']), $if_subnet_bits);
    }
    $subnet .= "/" . $a_vip[$id]['subnet_bits'];
    $if_subnet .= "/" . $if_subnet_bits;
    if (isset($config['gateways']['gateway_item'])) {
        foreach ($config['gateways']['gateway_item'] as $gateway) {
            if ($a_vip[$id]['interface'] != $gateway['interface']) {
                continue;
            }
            if ($is_ipv6 && $gateway['ipprotocol'] == 'inet') {
                continue;
            }
            if (!$is_ipv6 && $gateway['ipprotocol'] == 'inet6') {
                continue;
            }
            if (ip_in_subnet($gateway['gateway'], $if_subnet)) {
                continue;
            }
            if (ip_in_subnet($gateway['gateway'], $subnet)) {
                $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one Gateway.");
                break;
            }
        }
    }
    if ($a_vip[$id]['mode'] == "ipalias") {
        $subnet = gen_subnet($a_vip[$id]['subnet'], $a_vip[$id]['subnet_bits']) . "/" . $a_vip[$id]['subnet_bits'];
        $found_if = false;
        $found_carp = false;
        $found_other_alias = false;
        if ($subnet == $if_subnet) {
            $found_if = true;
        }
        $vipiface = $a_vip[$id]['interface'];
        foreach ($a_vip as $vip_id => $vip) {
            if ($vip_id != $id) {
                if ($vip['interface'] == $vipiface && ip_in_subnet($vip['subnet'], $subnet)) {
                    if ($vip['mode'] == "carp") {
                        $found_carp = true;
                    } else {
                        if ($vip['mode'] == "ipalias") {
                            $found_other_alias = true;
                        }
                    }
                }
            }
        }
        if ($found_carp === true && $found_other_alias === false && $found_if === false) {
            $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by a CARP IP with the description") . " {$vip['descr']}.";
        }
    }
    if (count($input_errors) == 0) {
        // Special case since every proxyarp vip is handled by the same daemon.
        if ($a_vip[$id]['mode'] == "proxyarp") {
            $viface = $a_vip[$id]['interface'];
            unset($a_vip[$id]);
            interface_proxyarp_configure($viface);
        } else {
            interface_vip_bring_down($a_vip[$id]);
            unset($a_vip[$id]);
        }
        if (count($config['virtualip']['vip']) == 0) {
            unset($config['virtualip']['vip']);
        }
    }
    return $input_errors;
}
开发者ID:8191,项目名称:opnsense-core,代码行数:94,代码来源:firewall_virtual_ip.php


示例3: isset

				    </header>

					<div class="content-box-main col-xs-12">
						<pre>

<?php

							$useicmp = isset($_REQUEST['useicmp']) ? "-I" : "";
							$n = isset($resolve) ? "" : "-n";

							$command = "/usr/sbin/traceroute";
							if ($ipproto == "ipv6") {
								$command .= "6";
								$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
							} else {
								$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
							}

							if ($ifaddr && (is_ipaddr($host) || is_hostname($host)))
								$srcip = "-s " . escapeshellarg($ifaddr);

							$cmd = "{$command} {$n} {$srcip} -w 2 {$useicmp} -m " . escapeshellarg($ttl) . " " . escapeshellarg($host);

							//echo "Traceroute command: {$cmd}\n";
							system($cmd);

?>
						</pre>
					</div>
				</div>
			</section>
开发者ID:nasaa0528,项目名称:core,代码行数:31,代码来源:diag_traceroute.php


示例4: gettext

     }
     if (empty($_POST['password'])) {
         $input_errors[] = gettext("You must specify a CARP password that is shared between the two VHID members.");
     }
     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);
     }
开发者ID:toshisam,项目名称:pfsense,代码行数:31,代码来源:firewall_virtual_ip_edit.php


示例5: gettext

     if (!is_numericint($_POST['n_l2tp_units']) || $_POST['n_l2tp_units'] > 255) {
         $input_errors[] = gettext("Number of L2TP users must be between 1 and 255");
     }
     /* if this is an AJAX caller then handle via JSON */
     if (isAjax() && is_array($input_errors)) {
         input_errors2Ajax($input_errors);
         exit;
     }
     if (!$input_errors) {
         $_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['l2tp_subnet']);
         $subnet_start = ip2ulong($_POST['remoteip']);
         $subnet_end = ip2ulong($_POST['remoteip']) + $_POST['n_l2tp_units'] - 1;
         if (ip2ulong($_POST['localip']) >= $subnet_start && ip2ulong($_POST['localip']) <= $subnet_end) {
             $input_errors[] = gettext("The specified server address lies in the remote subnet.");
         }
         if ($_POST['localip'] == get_interface_ip("lan")) {
             $input_errors[] = gettext("The specified server address is equal to the LAN interface address.");
         }
     }
 }
 /* if this is an AJAX caller then handle via JSON */
 if (isAjax() && is_array($input_errors)) {
     input_errors2Ajax($input_errors);
     exit;
 }
 if (!$input_errors) {
     $l2tpcfg['remoteip'] = $_POST['remoteip'];
     $l2tpcfg['localip'] = $_POST['localip'];
     $l2tpcfg['l2tp_subnet'] = $_POST['l2tp_subnet'];
     $l2tpcfg['mode'] = $_POST['mode'];
     $l2tpcfg['interface'] = $_POST['interface'];
开发者ID:z0x010,项目名称:pfsense,代码行数:31,代码来源:vpn_l2tp.php


示例6: gettext

                 $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one NAT mapping.");
                 break;
             }
         }
     }
 }
 if (is_ipaddrv6($a_vip[$_GET['id']]['subnet'])) {
     $is_ipv6 = true;
     $subnet = gen_subnetv6($a_vip[$_GET['id']]['subnet'], $a_vip[$_GET['id']]['subnet_bits']);
     $if_subnet_bits = get_interface_subnetv6($a_vip[$_GET['id']]['interface']);
     $if_subnet = gen_subnetv6(get_interface_ipv6($a_vip[$_GET['id']]['interface']), $if_subnet_bits);
 } else {
     $is_ipv6 = false;
     $subnet = gen_subnet($a_vip[$_GET['id']]['subnet'], $a_vip[$_GET['id']]['subnet_bits']);
     $if_subnet_bits = get_interface_subnet($a_vip[$_GET['id']]['interface']);
     $if_subnet = gen_subnet(get_interface_ip($a_vip[$_GET['id']]['interface']), $if_subnet_bits);
 }
 $subnet .= "/" . $a_vip[$_GET['id']]['subnet_bits'];
 $if_subnet .= "/" . $if_subnet_bits;
 if (is_array($config['gateways']['gateway_item'])) {
     foreach ($config['gateways']['gateway_item'] as $gateway) {
         if ($a_vip[$_GET['id']]['interface'] != $gateway['interface']) {
             continue;
         }
         if ($is_ipv6 && $gateway['ipprotocol'] == 'inet') {
             continue;
         }
         if (!$is_ipv6 && $gateway['ipprotocol'] == 'inet6') {
             continue;
         }
         if (ip_in_subnet($gateway['gateway'], $if_subnet)) {
开发者ID:hlcherub,项目名称:core,代码行数:31,代码来源:firewall_virtual_ip.php


示例7: array

 $entered_remote = array();
 $entered_remote['type'] = $pconfig['remoteid_type'];
 if (isset($pconfig['remoteid_address'])) {
     $entered_remote['address'] = $pconfig['remoteid_address'];
 }
 if (isset($pconfig['remoteid_netbits'])) {
     $entered_remote['netbits'] = $pconfig['remoteid_netbits'];
 }
 $entered_remoteid_data = ipsec_idinfo_to_cidr($entered_remote, false, $pconfig['mode']);
 list($entered_remote_network, $entered_remote_mask) = explode('/', $entered_remoteid_data);
 if ($phase1['protocol'] == "inet6") {
     $if = get_failover_interface($phase1['interface'], "inet6");
     $interfaceip = get_interface_ipv6($if);
 } else {
     $if = get_failover_interface($phase1['interface']);
     $interfaceip = get_interface_ip($if);
 }
 /* skip validation for hostnames, they're subject to change anyway */
 if (is_ipaddr($phase1['remote-gateway'])) {
     if ($pconfig['mode'] == "tunnel") {
         if (check_subnets_overlap($interfaceip, 32, $entered_local_network, $entered_local_mask) && check_subnets_overlap($phase1['remote-gateway'], 32, $entered_remote_network, $entered_remote_mask)) {
             $input_errors[] = gettext("The local and remote networks of a phase 2 entry cannot overlap the outside of the tunnel (interface and remote gateway) configured in its phase 1.");
             break;
         }
     } else {
         if ($pconfig['mode'] == "tunnel6") {
             if (check_subnetsv6_overlap($interfaceip, 128, $entered_local_network, $entered_local_mask) && check_subnets_overlap($phase1['remote-gateway'], 128, $entered_remote_network, $entered_remote_mask)) {
                 $input_errors[] = gettext("The local and remote networks of a phase 2 entry cannot overlap the outside of the tunnel (interface and remote gateway) configured in its phase 1.");
                 break;
             }
         }
开发者ID:jdillard,项目名称:pfsense,代码行数:31,代码来源:vpn_ipsec_phase2.php


示例8: explode

 $reqdfields = explode(" ", "name interface");
 $reqdfieldsn = array(gettext("Name"), gettext("Interface"));
 do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors);
 if (!isset($pconfig['name'])) {
     $input_errors[] = gettext("A valid gateway name must be specified.");
 }
 if (!is_validaliasname($pconfig['name'])) {
     $input_errors[] = gettext("The gateway name must not contain invalid characters.");
 }
 /* skip system gateways which have been automatically added */
 if (!empty($pconfig['gateway']) && !is_ipaddr($pconfig['gateway']) && $pconfig['attribute'] !== "system" && $pconfig['gateway'] != "dynamic") {
     $input_errors[] = gettext("A valid gateway IP address must be specified.");
 }
 if (!empty($pconfig['gateway']) && is_ipaddr($pconfig['gateway']) && !isset($_REQUEST['isAjax'])) {
     if (is_ipaddrv4($pconfig['gateway'])) {
         $parent_ip = get_interface_ip($pconfig['interface']);
         $parent_sn = get_interface_subnet($pconfig['interface']);
         if (empty($parent_ip) || empty($parent_sn)) {
             $input_errors[] = gettext("Cannot add IPv4 Gateway Address because no IPv4 address could be found on the interface.");
         } else {
             $subnets = array(gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn);
             $vips = link_interface_to_vips($_POST['interface']);
             if (is_array($vips)) {
                 foreach ($vips as $vip) {
                     if (!is_ipaddrv4($vip['subnet'])) {
                         continue;
                     }
                     $subnets[] = gen_subnet($vip['subnet'], $vip['subnet_bits']) . "/" . $vip['subnet_bits'];
                 }
             }
             $found = false;
开发者ID:siloportem,项目名称:core,代码行数:31,代码来源:system_gateways_edit.php


示例9: get_interface_ipv6

             $ifaddr = get_interface_ipv6($sourceip);
         }
     }
     $nc_args .= " -6";
 } else {
     switch ($ipprotocol) {
         case "ipv4":
             $ifaddr = get_interface_ip($sourceip);
             $nc_ipproto = " -4";
             break;
         case "ipv6":
             $ifaddr = is_linklocal($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
             $nc_ipproto = " -6";
             break;
         case "any":
             $ifaddr = get_interface_ip($sourceip);
             $nc_ipproto = !empty($ifaddr) ? " -4" : "";
             if (empty($ifaddr)) {
                 $ifaddr = is_linklocal($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
                 $nc_ipproto = !empty($ifaddr) ? " -6" : "";
             }
             break;
     }
     /* Netcat doesn't like it if we try to connect using a certain type of IP without specifying the family. */
     if (!empty($ifaddr)) {
         $nc_args .= $nc_ipproto;
     } elseif ($sourceip == "any") {
         switch ($ipprotocol) {
             case "ipv4":
                 $nc_ipproto = " -4";
                 break;
开发者ID:mtisza,项目名称:pfsense,代码行数:31,代码来源:diag_testport.php


示例10: gettext

echo gettext("RADIUS options");
?>
</td>
			</tr>

			<tr>
				<td class="vncell" valign="top"><?php 
echo gettext("RADIUS NAS IP attribute");
?>
</td>
				<td>
				<select name="radiussrcip_attribute" id="radiussrcip_attribute">
				<?php 
$iflist = get_configured_interface_with_descr();
foreach ($iflist as $ifdesc => $ifdescr) {
    $ipaddr = get_interface_ip($ifdesc);
    if (is_ipaddr($ipaddr)) {
        $selected = "";
        if ($ifdesc == $pconfig['radiussrcip_attribute']) {
            $selected = "selected";
        }
        echo "<option value='{$ifdesc}' {$selected}>{$ifdescr} - {$ipaddr}</option>\n";
    }
}
if (is_array($config['virtualip']['vip'])) {
    foreach ($config['virtualip']['vip'] as $sn) {
        if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
            $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
            $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
            $len = $end - $start;
            for ($i = 0; $i <= $len; $i++) {
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:services_captiveportal.php


示例11: getCalledStationId

 function getCalledStationId()
 {
     return get_interface_ip() . ":" . getNasPort();
 }
开发者ID:NewEraCracker,项目名称:pfsense,代码行数:4,代码来源:openvpn.auth-user.php


示例12: array

 $resolvecounter = 0;
 $fields_array = array();
 $pfblines = exec("/usr/local/sbin/clog {$filter_logfile} | /usr/bin/grep -c ^");
 $fields_array = conv_log_filter_lite($filter_logfile, $pfblines, $pfblines, $pfbdenycnt, $pfbpermitcnt, $pfbmatchcnt);
 $continents = array('pfB_Africa', 'pfB_Antartica', 'pfB_Asia', 'pfB_Europe', 'pfB_NAmerica', 'pfB_Oceania', 'pfB_SAmerica', 'pfB_Top');
 $supp_ip_txt = "Clicking this Suppression Icon, will immediately remove the Block.\n\nSuppressing a /32 CIDR is better than Suppressing the full /24";
 $supp_ip_txt .= " CIDR.\nThe Host will be added to the pfBlockerNG Suppress Alias Table.\n\nOnly 32 or 24 CIDR IPs can be Suppressed with the '+' Icon.";
 $supp_ip_txt .= "\nTo manually add Host(s), edit the 'pfBlockerNGSuppress' Alias in the Alias Tab.\nManual entries will not remove existing Blocked Hosts";
 // Array of all Local IPs for Alert Analysis
 $pfb_local = array();
 $pfb_localsub = array();
 // Collect Gateway IP Addresses for Inbound/Outbound List matching
 $int_gateway = get_interfaces_with_gateway();
 if (is_array($int_gateway)) {
     foreach ($int_gateway as $gateway) {
         $convert = get_interface_ip($gateway);
         $pfb_local[] = $convert;
     }
 }
 // Collect Virtual IP Aliases for Inbound/Outbound List Matching
 if (is_array($config['virtualip']['vip'])) {
     foreach ($config['virtualip']['vip'] as $list) {
         if ($list['subnet'] != "" && $list['subnet_bits'] != "") {
             if ($list['subnet_bits'] >= 24) {
                 $pfb_local = array_merge(subnetv4_expand("{$list['subnet']}/{$list['subnet_bits']}"), $pfb_local);
             } else {
                 $pfb_localsub[] = "{$list['subnet']}/{$list['subnet_bits']}";
             }
         }
     }
 }
开发者ID:randyqx,项目名称:pfsense-packages,代码行数:31,代码来源:pfblockerng_alerts.php


示例13: get_interface_ip

		</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td colspan="2" valign="top" class="listtopic">Stats example template</td>
		</tr>
		<tr>
			<td width="22%" valign="top" class="vncell">Example</td>
			<td class="vtable">
				As an basic example you can use the link below to create a 'stats' frontend/backend page which offers with more options like setting user/password and 'admin mode' when you go to the backend settings.<br/>
				<a href="haproxy_stats.php?add_stats_example=1">TEMPLATE: Create stats example configuration using a frontend/backend combination with ssl</a><br/>
				<br/>
				After applying the changes made by the template use this link to visit the stats page: <a target="_blank" href="https://<?php 
    echo get_interface_ip("lan");
    ?>
:444">https://pfSense-LAN-ip:444/</a>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td colspan="2" valign="top" class="listtopic">HAProxy stick-tables</td>
		</tr>
		<tr>
			<td colspan="2" valign="top" class="vncell">	
			These tables are used to store information for session persistence and can be used with ssl-session-id information, application-cookies, or other information that is used to persist a user to a server.
			<table class="tabcont sortable" id="sortabletable" width="100%" cellspacing="0" cellpadding="6" border="0">
			<head>
开发者ID:MarkVLK,项目名称:pfsense-packages,代码行数:31,代码来源:haproxy_stats.php


示例14: isset

##|*IDENT=page-services-dhcprelay
##|*NAME=Services: DHCP Relay
##|*DESCR=Allow access to the 'Services: DHCP Relay' page.
##|*MATCH=services_dhcp_relay.php*
##|-PRIV
require "guiconfig.inc";
require_once "filter.inc";
$pconfig['enable'] = isset($config['dhcrelay']['enable']);
if (empty($config['dhcrelay']['interface'])) {
    $pconfig['interface'] = array();
} else {
    $pconfig['interface'] = explode(",", $config['dhcrelay']['interface']);
}
$pconfig['agentoption'] = isset($config['dhcrelay']['agentoption']);
$iflist = array_intersect_key(get_configured_interface_with_descr(), array_flip(array_filter(array_keys(get_configured_interface_with_descr()), function ($if) {
    return is_ipaddr(get_interface_ip($if));
})));
/*   set the enabled flag which will tell us if DHCP server is enabled
 *   on any interface.   We will use this to disable dhcp-relay since
 *   the two are not compatible with each other.
 */
$dhcpd_enabled = false;
if (is_array($config['dhcpd'])) {
    foreach ($config['dhcpd'] as $dhcpif => $dhcp) {
        if (isset($dhcp['enable']) && isset($config['interfaces'][$dhcpif]['enable'])) {
            $dhcpd_enabled = true;
            break;
        }
    }
}
if ($_POST) {
开发者ID:curtiszimmerman,项目名称:pfsense,代码行数:31,代码来源:services_dhcp_relay.php


示例15: header

    exit;
}
require "guiconfig.inc";
$if = $_GET['if'];
if ($_POST['if']) {
    $if = $_POST['if'];
}
if (!$if) {
    header("Location: services_dhcp.php");
    exit;
}
if (!is_array($config['dhcpd'][$if]['staticmap'])) {
    $config['dhcpd'][$if]['staticmap'] = array();
}
$a_maps =& $config['dhcpd'][$if]['staticmap'];
$ifcfgip = get_interface_ip($if);
$ifcfgsn = get_interface_subnet($if);
$ifcfgdescr = convert_friendly_interface_to_friendly_descr($if);
$id = $_GET['id'];
if (isset($_POST['id'])) {
    $id = $_POST['id'];
}
if (isset($id) && $a_maps[$id]) {
    $pconfig['mac'] = $a_maps[$id]['mac'];
    $pconfig['hostname'] = $a_maps[$id]['hostname'];
    $pconfig['ipaddr'] = $a_maps[$id]['ipaddr'];
    $pconfig['descr'] = base64_decode($a_maps[$id]['descr']);
} else {
    $pconfig['mac'] = $_GET['mac'];
    $pconfig['hostname'] = $_GET['hostname'];
    $pconfig['descr'] = $_GET['descr'];
开发者ID:nuclewall,项目名称:nuclewall,代码行数:31,代码来源:services_dhcp_edit.php


示例16: build_radiusnas_list

function build_radiusnas_list()
{
    $list = array();
    $iflist = get_configured_interface_with_descr();
    foreach ($iflist as $ifdesc => $ifdescr) {
        $ipaddr = get_interface_ip($ifdesc);
        if (is_ipaddr($ipaddr)) {
            $list[$ifdescr] = $ifdescr . ' - ' . $ipaddr;
        }
    }
    if (is_array($config['virtualip']['vip'])) {
        foreach ($config['virtualip']['vip'] as $sn) {
            if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
                $start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
                $end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
                $len = $end - $start;
                for ($i = 0; $i <= $len; $i++) {
                    $snip = long2ip32($start + $i);
                    $list[$snip] = $sn['descr'] . ' - ' . $snip;
                }
            } else {
                $list[$sn['subnet']] = $sn['descr'] . ' - ' . $sn['subnet'];
            }
        }
    }
    return $list;
}
开发者ID:thiagoc,项目名称:pfsense,代码行数:27,代码来源:services_captiveportal.php


示例17: build_interface_list

function build_interface_list()
{
    global $pconfig;
    $iflist = array('options' => array(), 'selected' => array());
    $interfaces = get_configured_interface_with_descr();
    $carplist = get_configured_carp_interface_list();
    foreach ($carplist as $cif => $carpip) {
        $interfaces[$cif] = $carpip . " (" . get_vip_descr($carpip) . ")";
    }
    $aliaslist = get_configured_ip_aliases_list();
    foreach ($aliaslist as $aliasip => $aliasif) {
        $interfaces[$aliasip] = $aliasip . " (" . get_vip_descr($aliasip) . ")";
    }
    $size = count($interfaces) < 10 ? count($interfaces) : 10;
    foreach ($interfaces as $iface => $ifacename) {
        if (!is_ipaddr(get_interface_ip($iface)) && !is_ipaddr($iface)) {
            continue;
        }
        $iflist['options'][$iface] = $ifacename;
        if (in_array($iface, $pconfig['interface'])) {
            array_push($iflist['selected'], $iface);
        }
    }
    return $iflist;
}
开发者ID:jefersonJim,项目名称:pfsense,代码行数:25,代码来源:services_ntpd.php


示例18: printf

}
?>
 onClick="enable_change(false)">
                          <strong><?php 
printf(gettext("Enable DHCP relay on interface"));
?>
</strong>
			</td>
		</tr>
		<tr>
                        <td width="22%" valign="top" class="vncellreq">Interface(s)</td>
                        <td width="78%" class="vtable">
				<select id="interface" name="interface[]" multiple="true" class="formselect" size="3">
			<?php 
foreach ($iflist as $ifent => $ifdesc) {
    if (!is_ipaddr(get_interface_ip($ifent))) {
        continue;
    }
    echo "<option value='{$ifent}'";
    if (in_array($ifent, $pconfig['interface'])) {
        echo "selected";
    }
    echo ">{$ifdesc}</option>\n";
}
?>
                                </select>
				<br />Interfaces without an IP address will not be shown.
			</td>
		</tr>
		<tr>
	              <td width="22%" valign="top" class="vtable">&nbsp;</td>
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:services_dhcp_relay.php


示例19: fixup_string

function fixup_string($string)
{
    global $config;
    // fixup #1: $myurl -> http[s]://ip_address:port/
    $https = "";
    $port = $config['system']['webguiport'];
    if ($port != "443" and $port != "80") {
        $urlport = ":" . $port;
    } else {
        $urlport = "";
    }
    if ($config['system']['webgui']['protocol'] == "https") {
        $https = "s";
    }
    $myurl = "http" . $https . "://" . getenv("HTTP_HOST") . $urlport;
    $newstring = str_replace("\$myurl", $myurl, $string);
    $string = $newstring;
    // fixup #2: $wanip
    $curwanip = get_interface_ip();
    $newstring = str_replace("\$wanip", $curwanip, $string);
    $string = $newstring;
    // fixup #3: $lanip
    $lancfg = $config['interfaces']['lan'];
    $lanip = $lancfg['ipaddr'];
    $newstring = str_replace("\$lanip", $lanip, $string);
    $string = $newstring;
    // fixup #4: fix'r'up here.
    return $newstring;
}
开发者ID:nwholloway,项目名称:pfsense,代码行数:29,代码来源:pkg_edit.php


示例20: htmlspecialchars

    ?>
							</td>
							<td>
								<?php 
    echo htmlspecialchars($rfc2136['host']);
    ?>
							</td>
							<td>
<?php 
    $filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
    if (file_exists($filename)) {
        print 'IPv4: ';
        if (isset($rfc2136['usepublicip'])) {
            $ipaddr = dyndnsCheckIP($rfc2136['interface']);
        } else {
            $ipaddr = get_interface_ip($rfc2136['interface']);
        }
        $cached_ip_s = explode("|", file_get_contents($filename));
        $cached_ip = $cached_ip_s[0];
        if ($ipaddr != $cached_ip) {
            print '<span class="text-danger">';
        } else {
            print '<span class="text-success">';
        }
        print htmlspecialchars($cached_ip);
        print '</span>';
    } else {
        print 'IPv4: N/A';
    }
    print '<br />';
    if (file_exists("{$filename}.ipv6")) {
开发者ID:hexaclock,项目名称:pfsense,代码行数:31,代码来源:services_rfc2136.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_interface_ipv6函数代码示例发布时间:2022-05-15
下一篇:
PHP get_interface_info函数代码示例发布时间: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