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


PHP Subnets::is_subnet_inside_subnet方法代码示例

本文整理汇总了PHP中Subnets::is_subnet_inside_subnet方法的典型用法代码示例。如果您正苦于以下问题:PHP Subnets::is_subnet_inside_subnet方法的具体用法?PHP Subnets::is_subnet_inside_subnet怎么用?PHP Subnets::is_subnet_inside_subnet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subnets的用法示例。


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

示例1: cmp_subnets

    }
}
# sort by mask size
function cmp_subnets($a, $b)
{
    if ($a['subnet_dec'] == $b['subnet_dec']) {
        return 0;
    }
    return $a['subnet_dec'] < $b['subnet_dec'] ? -1 : 1;
}
usort($subnets_all, "cmp_subnets");
# recompute parents
foreach ($subnets_all as $k => $s) {
    foreach ($subnets_all as $sb) {
        if ($sb['subnet_dec'] !== $s['subnet_dec'] && $sb['mask'] !== $s['mask']) {
            if ($Subnets->is_subnet_inside_subnet($s['subnet'], $sb['subnet'])) {
                $subnets_all[$k]['master'] = $sb['subnet'];
            }
        }
    }
}
# import each
if (isset($subnets_all)) {
    foreach ($subnets_all as $s) {
        # set new POST
        $_POST = $s;
        # create csrf token
        $_POST['csrf_cookie'] = $User->csrf_cookie("create", "subnet");
        # permissions
        $subnet['permissions'] = $section->permissions;
        # check for master
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:subnet-scan-snmp-route-all-result.php

示例2: foreach

 print "</tr>";
 print "<tbody id=device-{$deviceid}>";
 foreach ($query_result as $ip) {
     //get bitmask
     foreach ($masks as $k => $n) {
         if ($n->netmask == $ip['mask']) {
             $ip['bitmask'] = $k;
             break;
         }
     }
     $overlap = false;
     // check for overlapping
     if (isset($subnet)) {
         if ($subnet->isFolder != "1") {
             // check
             if ($Subnets->is_subnet_inside_subnet("{$ip['subnet']}/{$ip['bitmask']}", $Subnets->transform_address($subnet->subnet, "dotted") . "/" . $subnet->mask) === false) {
                 $overlap = true;
             }
             // same mask
             if ($ip['subnet'] == $Subnets->transform_address($subnet->subnet, "dotted") && $ip['bitmask'] == $subnet->mask) {
                 $overlap = true;
             }
         }
     }
     // check overlapping
     if ($overlap === false) {
         $dc++;
         print "<tr id='tr-{$m}'>";
         //ip
         print "<td>{$ip['subnet']}/{$ip['bitmask']}</td>";
         //section, description, hidden
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:subnet-scan-snmp-route-all.php


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