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


PHP Host::find方法代码示例

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


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

示例1: alerts_list

function alerts_list()
{
    //Go through all the hosts and determine if any alerts should be created
    global $hosts;
    $h = new Host();
    $hosts = $h->find();
    $alerts = new Alert();
    foreach ($hosts as $host) {
        foreach ($host->ports() as $port) {
            $status = $host->get_port_status($port, true);
            if ($status == 0) {
                if ($alert = $alerts->find("WHERE host_id = " . $host->id . " AND port = " . $port)) {
                    //There is already an alert for this, go through each user and see what their preference for this port is
                    send_user_alerts($host->id, $port, $alert->id, 'all');
                } else {
                    $alert = new alert();
                    $alert->message = "HOST: " . $host->name . "PORT: " . $port . "";
                    $alert->user_id = 1;
                    $alert->host_id = $host->id;
                    $alert->port = $port;
                    $alert->sent_on = time();
                    $alert->save();
                    send_user_alerts($host->id, $port, $alert->id, 'single');
                    //Go through each user and determine what their preference for this port is.
                }
            } else {
                //The port is up, but we need to set up reports if there is an existing one!
                if ($alert = $alerts->find("WHERE host_id = " . $host->id . " AND port = " . $port)) {
                    //There is already an alert for this, go through each user and see what their preference for this port is
                    send_user_alerts($host->id, $port, $alert->id, 'single');
                }
            }
        }
    }
    render();
}
开发者ID:bjcpgd,项目名称:palserve,代码行数:36,代码来源:alerts.php

示例2: test_to_xml_include

 public function test_to_xml_include()
 {
     $xml = Host::find(4)->to_xml(array('include' => 'events'));
     $decoded = get_object_vars(new SimpleXMLElement($xml));
     $this->assert_equals(3, count($decoded['events']->event));
 }
开发者ID:Arunkumarcs,项目名称:Themis-Reinitialize,代码行数:6,代码来源:SerializationTest.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Session::token() != Input::get('_token') || !Request::ajax()) {
         App::abort(401, 'You are not authorized or using wrong request type or csrf token not provided.');
     }
     $host = Host::find($id);
     $host->delete();
     return "Host removed";
 }
开发者ID:snake007v,项目名称:nefarious-octo-woof,代码行数:15,代码来源:HostController.php

示例4: update_scan_script

function update_scan_script()
{
    //We are going to create an nmap script for every host and all their ports, and save the results in XML
    global $hosts;
    $h = new Host();
    $hosts = $h->find();
    foreach ($hosts as $host) {
        $ports = $host->ports;
        $name = $host->name;
        $cmd[] = "#!/bin/bash\ncd /var/www/admin/scan/commands\n#SCAN for {$name}\nnmap -P0 -O -p {$ports} {$name} -oX ../results/{$name}.xml -oG ../results/{$name}.txt --stylesheet ../nmap.xsl > /dev/null\n";
    }
    $script = "#!/bin/bash\n\n#The nmap commands\n" . implode('', $cmd) . "\n### END of COMMANDS ###\n";
    file_put_contents('commands/run_scan.sh', $script);
}
开发者ID:bjcpgd,项目名称:palserve,代码行数:14,代码来源:hosts.php


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