Пример #1
0
        return $instances_obj;
    }
}
if (!isset($_GET["demo"])) {
    include_once 'game_config.php';
    include_once 'overview-adapter.php';
    if (!isset($_GET['game'])) {
        if (isset($_GET['gameid'])) {
            include_once 'gameidMap.php';
            define('TTL', 30 * 60);
            //cache expiry time for apc is 30min
            $key = "gameid";
            $gameidArray = apc_fetch($key, $success);
            if ($success) {
            } else {
                $gameidArray = getGameMapping($server_cfg);
                apc_add($key, $gameidArray, TTL);
            }
            $game = $gameidArray[$_GET['gameid']];
            if (!isset($game)) {
                $game = $server_cfg['game_list'][0];
            }
        } else {
            $game = $server_cfg['game_list'][0];
        }
    } else {
        $game = $_GET['game'];
    }
    $instances_obj = get_instance_util_data($game);
    $game_cfg = load_game_config($game);
    $dataObj = new OverviewAdapter($game_cfg);
Пример #2
0
 public function getTrackedFunction($values, $game_name)
 {
     if (is_numeric($game_name)) {
         include_once 'gameidMap.php';
         $gidmap = getGameMapping($this->server_cfg);
         if (isset($gidmap[$game_name])) {
             $game_name = $gidmap[$game_name];
         }
     }
     $return_array = $this->parse_inputs_timestamp($values);
     if ($return_array === false) {
         return;
     }
     $tracked_functions = array("MC::set", "MC::get", "ApcManager::get", "ApcManager::set", "serialize", "unserialize", "AMFBaseSerializer::serialize", "AMFBaseDeserializer::deserialize");
     $return_array["entity"] = $this->parse_inputs_entity($values);
     if ($return_array["entity"] === false) {
         $wrapped_functions = $this->wrap_escape($tracked_functions, "`");
         $tracked = implode(",", $wrapped_functions);
     } else {
         $wrapped_functions = $this->wrap_escape(explode(",", $return_array["entity"]), "`");
         $tracked = implode(",", $wrapped_functions);
     }
     if (isset($return_array["ts"])) {
         $query = "SELECT unix_timestamp(timestamp) as timestamp, {$tracked} FROM zprf_" . $game_name . ".tracked_functions_flip_incl_time where page='all' and unix_timestamp(timestamp) = " . $return_array['ts'];
     } else {
         if (isset($return_array["tstart"]) and isset($return_array["tend"])) {
             $query = "SELECT unix_timestamp(timestamp) as timestamp, {$tracked} FROM zprf_" . $game_name . ".tracked_functions_flip_incl_time where page='all' and unix_timestamp(timestamp) between " . $return_array['tstart'] . " and " . $return_array["tend"];
         } else {
             $query = "SELECT unix_timestamp(timestamp) as timestamp, {$tracked} FROM zprf_" . $game_name . ".tracked_functions_flip_incl_time where page='all' order by timestamp desc limit 1";
         }
     }
     $stmt = $this->prepare($query);
     $rows = $this->fetchAll($stmt, NULL);
     if (isset($rows[0]) and isset($rows[0]) != NULL) {
         $this->status = 0;
         foreach ($rows as $val) {
             $timestamp = $val["timestamp"];
             foreach ($tracked_functions as $key => $function) {
                 if (isset($val[$function])) {
                     $this->lastError[$function][$timestamp] = $val[$function];
                 }
             }
         }
     } else {
         $this->status = 1;
         $this->lastError = "Unable to get data from DB or invalid timestamp given.";
     }
 }