Пример #1
0
 public function createApplication()
 {
     $ems = new Monitor();
     $ems->run();
     $app = $ems->getApp();
     $app['debug'] = true;
     unset($app['exception_handler']);
     return $app;
 }
Пример #2
0
<?php

$router = array('apple' => array('url' => 'http://zg-router.youxi021.com', 'ver' => '1.7.1'), 'kingnet' => array('url' => 'http://router.zg.kingnet.com', 'ver' => '1.8.0'), 'jp' => array('url' => 'zg-jp-router.ucube.mobi', 'ver' => '1.4.0'), 'kr' => array('url' => 'http://zg-kr-router.kingnet.com', 'ver' => '1.6.0'));
$Monitor = new Monitor($router);
$Monitor->run();
$error_list = $Monitor->get_error();
if (!empty($error_list)) {
    echo implode("\r\n", $error_list);
    exit;
}
class Monitor
{
    private $router_server = array();
    private $login_server = array();
    private $game_server = array();
    private $error_list = array();
    private $user_info = array();
    public function __construct($router_server)
    {
        $this->set_router($router_server);
        $this->user_info['email'] = '*****@*****.**';
        $this->user_info['password'] = '******';
        $this->user_info['mac'] = "111111111111";
    }
    public function set_router($router_server)
    {
        $this->router_server = $router_server;
    }
    public function get_error()
    {
        return $this->error_list;
Пример #3
0
 /**
  * This function includes the IDS vendor parts and runs the
  * detection routines on the request array.
  *
  * @param object cake controller object
  * @return boolean
  */
 public function detect(&$controller)
 {
     $this->controller =& $controller;
     $this->name = Inflector::singularize($this->controller->name);
     #set include path for IDS  and store old one
     $path = get_include_path();
     set_include_path(VENDORS . 'phpids/');
     #require the needed files
     vendor('phpids/IDS/Init');
     #add request url and user agent
     $_REQUEST['IDS_request_uri'] = $_SERVER['REQUEST_URI'];
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $_REQUEST['IDS_user_agent'] = $_SERVER['HTTP_USER_AGENT'];
     }
     #init the PHPIDS and pass the REQUEST array
     $this->init = Init::init();
     $ids = new Monitor($_REQUEST, $this->init);
     $result = $ids->run();
     // Re-set include path
     set_include_path($path);
     if (!$result->isEmpty()) {
         $this->react($result);
     }
     return true;
 }
Пример #4
0
} catch (PDOException $e) {
    echo $e->getMessage() . "\n";
}
$i = 1;
foreach ($monitors as $monitor) {
    //print_r($monitor);
    $pid = pcntl_fork();
    /*
     if ($pid == -1) {
     die('could not fork');
     }
    */
    if (!$pid) {
        echo 'Executing Child #' . $i . "..\n";
        $mon = new Monitor($dsn, $monitor);
        $mon->run();
        exit($i);
    } elseif ($pid) {
        //echo "execute in parent \n";
        //nothing to do
    }
    $i++;
}
foreach ($servers as $server) {
    //print_r($server);
    $pid = pcntl_fork();
    /*
     if ($pid == -1) {
     die('could not fork');
     }
    */
Пример #5
0
<?php

require_once 'Monitor.php';
$monitor = new Monitor();
$monitor->run();