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


PHP Addresses::modify_address方法代码示例

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


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

示例1:

     # validate and normalize MAC address
     if ($action !== "delete") {
         if (strlen(@$address['mac']) > 0) {
             if ($User->validate_mac($address['mac']) === false) {
                 $errors[] = _('Invalid MAC address') . "!";
             } else {
                 $address['mac'] = $User->reformat_mac_address($address['mac'], 1);
             }
         }
     }
     # modify action - if delete ok, dynamically reset add / edit -> if IP already exists set edit
     if ($action != "delete") {
         $address['action'] = $Addresses->address_exists($m, $address['subnetId']) === true ? "edit" : "add";
     }
     # if it fails set error log
     if (!$Addresses->modify_address($address, false)) {
         $errors[] = _('Cannot') . ' ' . $address['action'] . ' ' . _('IP address') . ' ' . $Addresses->transform_to_dotted($m);
     }
     # next IP
     $m = gmp_strval(gmp_add($m, 1));
 }
 # print errors if they exist
 if (isset($errors)) {
     $log = $Result->array_to_log($errors);
     $Result->show("danger", $log, false);
     $Log->write("IP address modification", "'Error {$action} range {$address['start']} - {$address['stop']}<br> {$log}", 2);
 } else {
     # reset IP for mailing
     $address['ip_addr'] = $address['start'] . ' - ' . $address['stop'];
     # log and changelog
     $Result->show("success", _("Range") . " {$address['start']} - {$address['stop']} " . _($action) . " " . _("successfull") . "!", false);
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:address-modify-submit.php

示例2: Result

$Result = new Result();
# insert to database
$discovered = 0;
//for mailing
foreach ($scan_subnets as $s) {
    if (sizeof(@$s->discovered) > 0) {
        foreach ($s->discovered as $ip) {
            // fetch subnet
            $subnet = $Subnets->fetch_subnet("id", $s->id);
            $nsid = $subnet === false ? false : $subnet->nameserverId;
            // try to resolve hostname
            $hostname = $DNS->resolve_address($ip, false, true, $nsid);
            //set update query
            $values = array("subnetId" => $s->id, "ip_addr" => $Subnets->transform_address($ip, "decimal"), "dns_name" => $hostname['name'], "description" => "-- autodiscovered --", "note" => "This host was autodiscovered on " . $nowdate, "lastSeen" => $nowdate, "state" => "2", "action" => "add");
            //insert
            $Addresses->modify_address($values);
            //set discovered
            $discovered++;
        }
    }
}
# update scan time
$Scan->ping_update_scanagent_checktime(1, $nowdate);
# send mail
if ($discovered > 0 && $send_mail) {
    # check for recipients
    foreach ($Admin->fetch_multiple_objects("users", "role", "Administrator") as $admin) {
        if ($admin->mailNotify == "Yes") {
            $recepients[] = array("name" => $admin->real_name, "email" => $admin->email);
        }
    }
开发者ID:mwodz,项目名称:phpipam,代码行数:31,代码来源:discoveryCheck.php

示例3: array

            }
        }
        // set action
        if ($id = $Addresses->address_exists($lineArr[0], $_POST['subnetId'], false)) {
            $action = "edit";
        } else {
            $action = "add";
        }
        // set insert / update values
        $address_insert = array("action" => $action, "subnetId" => $_POST['subnetId'], "ip_addr" => $lineArr[0], "state" => $Addresses->address_type_type_to_index($lineArr[1]), "description" => $lineArr[2], "dns_name" => $lineArr[3], "mac" => $lineArr[4], "owner" => $lineArr[5], "switch" => $lineArr[6], "port" => $lineArr[7], "note" => $lineArr[8]);
        // add id
        if ($action == "edit") {
            $address_insert["id"] = $id;
        }
        // insert
        if ($Addresses->modify_address($address_insert) === false) {
            $errors++;
        } else {
            if ($action == "edit") {
                $edit++;
            } else {
                $add++;
            }
        }
    }
}
# print success if no errors
if ($errors == 0) {
    $Result->show("success", _('Import successfull'), false);
    # erase file on success
    unlink('upload/import.' . $filetype);
开发者ID:julsoj,项目名称:phpipam,代码行数:31,代码来源:import-file.php


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