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

PHP ip_in_interface_alias_subnet函数代码示例

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

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



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

示例1: get_interface_ip

     }
     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.");
     } else {
         if (strpos($_POST['interface'], '_vip')) {
             $input_errors[] = gettext("A CARP parent interface can only be used with IP Alias type Virtual IPs.");
         }
     }
     break;
开发者ID:toshisam,项目名称:pfsense,代码行数:31,代码来源:firewall_virtual_ip_edit.php


示例2: sprintf

         $input_errors[] = sprintf(gettext("The IP address cannot be the %s network address."), $ifcfgdescr);
     }
     if ($ipaddr_int == $lansubnet_end) {
         $input_errors[] = sprintf(gettext("The IP address cannot be the %s broadcast address."), $ifcfgdescr);
     }
 }
 if ($_POST['gateway'] && !is_ipaddrv4($_POST['gateway'])) {
     $input_errors[] = gettext("A valid IP address must be specified for the gateway.");
 }
 if ($_POST['wins1'] && !is_ipaddrv4($_POST['wins1']) || $_POST['wins2'] && !is_ipaddrv4($_POST['wins2'])) {
     $input_errors[] = gettext("A valid IP address must be specified for the primary/secondary WINS servers.");
 }
 $parent_ip = get_interface_ip($POST['if']);
 if (is_ipaddrv4($parent_ip) && $_POST['gateway']) {
     $parent_sn = get_interface_subnet($_POST['if']);
     if (!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn) && !ip_in_interface_alias_subnet($_POST['if'], $_POST['gateway'])) {
         $input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
     }
 }
 if ($_POST['dns1'] && !is_ipaddrv4($_POST['dns1']) || $_POST['dns2'] && !is_ipaddrv4($_POST['dns2']) || $_POST['dns3'] && !is_ipaddrv4($_POST['dns3']) || $_POST['dns4'] && !is_ipaddrv4($_POST['dns4'])) {
     $input_errors[] = gettext("A valid IP 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.");
 }
开发者ID:sjourdois,项目名称:pfsense,代码行数:31,代码来源:services_dhcp_edit.php


示例3: gettext

     }
     if (empty($pconfig['password'])) {
         $input_errors[] = gettext("You must specify a CARP password that is shared between the two VHID members.");
     }
     if (is_ipaddrv4($pconfig['subnet'])) {
         $parent_ip = get_interface_ip($pconfig['interface']);
         $parent_sn = get_interface_subnet($pconfig['interface']);
         $subnet = gen_subnet($parent_ip, $parent_sn);
     } else {
         if (is_ipaddrv6($pconfig['subnet'])) {
             $parent_ip = get_interface_ipv6($pconfig['interface']);
             $parent_sn = get_interface_subnetv6($pconfig['interface']);
             $subnet = gen_subnetv6($parent_ip, $parent_sn);
         }
     }
     if (isset($parent_ip) && !ip_in_subnet($pconfig['subnet'], "{$subnet}/{$parent_sn}") && !ip_in_interface_alias_subnet($pconfig['interface'], $pconfig['subnet'])) {
         $cannot_find = $pconfig['subnet'] . "/" . $pconfig['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);
     }
     if ($pconfig['interface'] == "lo0") {
         $input_errors[] = gettext("For this type of vip localhost is not allowed.");
     }
 } else {
     if ($pconfig['mode'] != 'ipalias' && $pconfig['interface'] == "lo0") {
         $input_errors[] = gettext("For this type of vip localhost is not allowed.");
     }
 }
 if (count($input_errors) == 0) {
     $vipent = array();
     // defaults
     $vipent['type'] = "single";
开发者ID:8191,项目名称:opnsense-core,代码行数:31,代码来源:firewall_virtual_ip_edit.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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