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


PHP Subnets::fetch_all_subnets_search方法代码示例

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


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

示例1: _

$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database, false);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->csrf_cookie("create", "linkedsubnet");
# ID must be numeric
if (!is_numeric($_POST['subnetId'])) {
    $Result->show("danger", _("Invalid ID"), true, true);
}
# get all IPv6 subnets
$ipv6_subnets = $Subnets->fetch_all_subnets_search("IPv6");
# get subnet details
$subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']);
?>



<!-- header -->
<div class="pHeader"><?php 
print _('Link IPv4 subnet to IPv6 subnet');
?>
</div>

<!-- content -->
<div class="pContent">
	<span class='muted'><?php 
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:linked-subnet.php

示例2: search_subnets_inside_v6

 /**
  * Search inside subnets if host address is provided! ipv6
  *
  * @access private
  * @param mixed $search_term
  * @param number $high
  * @param number $low
  * @return array
  */
 private function search_subnets_inside_v6($high, $low, $search_req)
 {
     // same
     if ($low == $high) {
         # Initialize PEAR NET object
         $this->initialize_pear_net_IPv6();
         // validate
         if ($this->Net_IPv6->checkIPv6($search_req)) {
             # ifmask remove it
             if (strpos($search_req, "/") > 0) {
                 $search_req = $this->Net_IPv6->removeNetmaskSpec($search_req);
             }
             # subnets class
             $Subnets = new Subnets($this->Database);
             # fetch all subnets
             $subnets = $Subnets->fetch_all_subnets_search("IPv6");
             # loop and search
             foreach ($subnets as $s) {
                 # cast
                 $s = (array) $s;
                 # parse address
                 $net = $this->Net_IPv6->parseAddress($this->transform_address($s['subnet'], "dotted") . '/' . $s['mask']);
                 if (gmp_cmp($low, $this->transform_address(@$net['start'], "decimal")) == 1 && gmp_cmp($low, $this->transform_address($net['end'], "decimal")) == -1) {
                     $ids[] = $s['id'];
                 }
             }
             # filter
             $ids = sizeof(@$ids) > 0 ? array_filter($ids) : array();
             # search
             if (sizeof($ids) > 0) {
                 foreach ($ids as $id) {
                     $result[] = $Subnets->fetch_subnet(null, $id);
                 }
             }
             # return
             return sizeof(@$result) > 0 ? array_filter($result) : array();
         } else {
             return array();
         }
     } else {
         return array();
     }
 }
开发者ID:julsoj,项目名称:phpipam,代码行数:52,代码来源:class.Tools.php

示例3: search_subnets_inside

 /**
  * Search inside subnets if host address is provided!
  *
  * @access private
  * @param mixed $search_term
  * @param number $high
  * @param number $low
  * @return array
  */
 private function search_subnets_inside($high, $low)
 {
     if ($low == $high) {
         # subnets class
         $Subnets = new Subnets($this->Database);
         # fetch all subnets
         $subnets = $Subnets->fetch_all_subnets_search();
         # loop and search
         foreach ($subnets as $s) {
             # cast
             $s = (array) $s;
             //first verify address type
             $type = $Subnets->identify_address($s['subnet']);
             if ($type == "IPv4") {
                 # Initialize PEAR NET object
                 $this->initialize_pear_net_IPv4();
                 # parse address
                 $net = $this->Net_IPv4->parseAddress($Subnets->transform_to_decimal($s['subnet']) . '/' . $s['mask']);
                 if ($low > $Subnets->transform_to_decimal(@$net->network) && $low < $Subnets->transform_to_decimal($net->broadcast)) {
                     $ids[] = $s['id'];
                 }
             }
         }
         # filter
         $ids = sizeof(@$ids) > 0 ? array_filter($ids) : array();
         # search
         if (sizeof($ids) > 0) {
             foreach ($ids as $id) {
                 $result[] = $Subnets->fetch_subnet(null, $id);
             }
         }
         # return
         return sizeof(@$result) > 0 ? array_filter($result) : array();
     } else {
         return array();
     }
 }
开发者ID:jonashauge,项目名称:phpipam,代码行数:46,代码来源:class.Tools.php


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