Пример #1
0
<?php

$html_title = "WinBolo.net: Game Information";
require "../php/header.php";
include "{$BASE_FILES}/inc_top.php";
$ip = $HTTP_GET_VARS['ip'];
$port = $HTTP_GET_VARS['port'];
$key = $HTTP_GET_VARS['key'];
$info = getGameInfo($ip, $port, $key);
if ($info == 0) {
    $error_body = "Sorry this game is no longer in progress.<p>You may like to try the <a href='/archivedgames.php'>Archived Game Logs</a>";
    include "{$BASE_FILES}/inc_error.php";
} else {
    $log = getGameLog($info->getKey());
    include "{$BASE_FILES}/inc_gamedetail.php";
}
include "{$BASE_FILES}/inc_bottom.php";
Пример #2
0
function ArcadeIBP32GetGame()
{
    if (empty($_POST['gname'])) {
        return false;
    }
    return getGameInfo($_POST['gname']);
}
Пример #3
0
 protected function tick()
 {
     // Override this for any process that should happen periodically.  Will happen at least once
     // per second, but possibly more often.
     #Because of that, we only run this every X seconds.
     if (count($this->users) > 0) {
         $currentTime = time();
         $diff = $currentTime - $this->broadcastTimestamp;
         #Broadcast to all users our loading status.
         $loadingIcon = 0;
         if ($this->resolveActionsTimestamp - $currentTime <= 5) {
             $loadingIcon = 1;
         }
         $statusMsg = "<loading>" . $loadingIcon . "</loading>";
         foreach ($this->users as $user) {
             if ($user->handshake) {
                 $this->send($user, $statusMsg);
             }
         }
         if ($diff > $this->broadcastInterval) {
             #Diagnostics
             $this->debugLog("Diagnosing tick");
             $this->debugLog("currentTime=" . $currentTime);
             $this->debugLog("this->chatUpdateTimestamp=" . $this->chatUpdateTimestamp);
             $this->debugLog("this->fullUpdateBacklog=" . count($this->fullUpdateBacklog) . " users");
             $this->debugLog("this->gameCreationTimestamp=" . $this->gameCreationTimestamp);
             $this->debugLog("this->gameID=" . $this->gameID);
             $this->debugLog("this->gameUpdateTimestamp=" . $this->gameUpdateTimestamp);
             $this->debugLog("this->resolveActionsTimestamp=" . $this->resolveActionsTimestamp);
             $this->debugLog("this->shouldBroadcastFullUpdate=" . $this->shouldBroadcastFullUpdate);
             if ($currentTime > $this->resolveActionsTimestamp && $this->gameID !== null && $this->resolveActionsTimestamp !== -1) {
                 $this->debugLog("Server Tick - Resolving actions");
                 #Resolve actions instead of broadcasting.
                 if (resolveAllActions($this->gameID)) {
                     $this->resolveActionsTimestamp = time() + $this->autoresolutionInterval;
                 } else {
                     $this->gameCreationTimestamp = time() + $this->gameCreationInterval;
                     $this->resolveActionsTimestamp = -1;
                 }
             } else {
                 if ($this->shouldBroadcastFullUpdate && count($this->fullUpdateBacklog) > 0) {
                     $this->debugLog("Server Tick - Broadcasting full game to everyone in backlog");
                     #Broadcast full updates to anyone who is in the backlog of updates.
                     $update = "<update>";
                     $update .= getGameInfo($this->gameID, 0, true);
                     $update .= getGameChat(0, true);
                     $update .= "</update>";
                     $this->debugLog($update);
                     $tempBackup = array();
                     foreach ($this->fullUpdateBacklog as $user) {
                         if ($user->handshake) {
                             $this->send($user, $update);
                         } else {
                             array_push($tempBackup, $user);
                         }
                     }
                     $this->fullUpdateBacklog = $tempBackup;
                     if (count($this->fullUpdateBacklog) === 0) {
                         $this->shouldBroadcastFullUpdate = false;
                     }
                 } else {
                     $this->debugLog("Server Tick - Partial updates and other things");
                     #Broadcast partial updates if necessary.
                     $update = "<update>";
                     $shouldUpdate = false;
                     if ($this->gameCreationTimestamp !== -1 && $currentTime > $this->gameCreationTimestamp) {
                         $this->debugLog("Server Tick - We think we should create a new game");
                         $this->gameID = null;
                     }
                     #If gameID is null
                     if ($this->gameID === null) {
                         $this->debugLog("Server Tick - Creating new game");
                         #Create a new game since we do not have one currently, then add all players to the full update backlog.
                         $this->createGame();
                     } else {
                         $this->debugLog("Server Tick - checking for partial updates");
                         #Set our ID to the latest game
                         $this->gameID = getLatestGameID();
                         $shouldUpdate = false;
                         if ($this->gameID !== null) {
                             #Get update time for game.
                             $updated = getGameUpdateTime($this->gameID);
                             $this->debugLog("Server Tick - Game thinks it was last updated at " . $updated);
                             #If update time is newer
                             if ($updated > $this->gameUpdateTimestamp) {
                                 $this->debugLog("Server Tick - Getting partial information from game");
                                 #Update our stuff accordingly.
                                 $update .= getGameInfo($this->gameID, $this->gameUpdateTimestamp, false);
                                 $this->gameUpdateTimestamp = $updated;
                                 $shouldUpdate = true;
                             }
                         }
                         #Check for chat updates.
                         $chatUpdated = getChatUpdateTime();
                         $this->debugLog("Server Tick - Chat thinks it was last updated at " . $chatUpdated);
                         if ($chatUpdated > $this->chatUpdateTimestamp) {
                             $this->debugLog("Server Tick - Getting partial information from chat");
                             $update .= getGameChat($this->chatUpdateTimestamp, false);
                             $this->chatUpdateTimestamp = $chatUpdated;
                             $shouldUpdate = true;
                         }
                         $update .= "</update>";
                         #If there have been updates
                         if ($shouldUpdate && count($this->users) > 0) {
                             #For each user
                             foreach ($this->users as $user) {
                                 if ($user->handshake) {
                                     $this->send($user, $update);
                                 }
                             }
                         }
                     }
                 }
             }
             $this->broadcastTimestamp = time();
             $this->debugLog("");
         }
     } else {
         if ($this->resolveActionsTimestamp !== -1) {
             $this->resolveActionsTimestamp = time() + $this->autoresolutionInterval;
         }
     }
 }
Пример #4
0
function ArcadeV2Score()
{
    global $scripturl, $txt, $db_prefix, $context, $sourcedir, $modSettings, $smcFunc;
    checkSession('post');
    ob_end_clean();
    if (!empty($modSettings['enableCompressedOutput'])) {
        @ob_start('ob_gzhandler');
    } else {
        ob_start();
    }
    $game = getGameInfo($_REQUEST['game']);
    if ($game === false) {
        v2Error('invalid_game');
    }
    $session =& $_SESSION['arcade_play_' . $game['id']];
    $extra =& $_SESSION['arcade_play_extra_' . $game['id']];
    if (empty($_POST['score'])) {
        v2Error('invalid_try');
    }
    $score_hash = $_POST['score'] . $session['hash'] . $session['score_hash'];
    if ($score_hash != $_POST['secret']) {
        v2Error('invalid_hash');
    }
    if (!sha1($_REQUEST['game'] . $_POST['score']) == $session['request_id']) {
        v2Error('invalid_hash');
    }
    if (!compHsha($_POST['score_hash'], $_POST['score'] . '-' . $session['hash'] . '-' . $session['score_hash'])) {
        v2Error('invalid_hash');
    }
    if (!compHsha($_POST['secret2'], $_POST['score'] . '-' . $score_hash)) {
        v2Error('invalid_hash');
    }
    if (microtime_float() - $session['score_hash_time'] > 5) {
        v2Error('invalid_try');
    }
    $session['scores'][] = array('maxTries' => $_POST['maxTries'], 'endTime' => round($_POST['endTime'] / 1000), 'startTime' => round($_POST['startTime'] / 1000), 'serverTime' => time(), 'playerName' => $_POST['playerName'], 'try' => $_POST['tries'], 'score' => $_POST['score'], 'level' => $_POST['level'] != 'undefined' ? $_POST['level'] : '', 'hash' => serialize(array('2.5.0', $_REQUEST['game'], $_POST['score'], $session['hash'], $session['score_hash'], $_POST['secret'], $_POST['score_hash'], $_POST['secret2'])));
    $session['request_id'] = '';
    echo '&maxtry=', $session['maxTries'];
    obExit(false);
}
Пример #5
0
                                                ?>
', 'test' )" /> 
		  <input class="btn btn-xs btn-prmary" type="button" onclick="CloseDiv('ratings-<?php 
                                                echo $slot;
                                                ?>
')" value="Cancel" class="menuButtons" />
		  <div>max. 255 characters</div>
		  </div>
		 </div>
		 <?php 
                                                die;
                                            }
                                            if ($rate <= 0 or $rate > 5) {
                                                die("Invalid value!");
                                            }
                                            $sth = $db->prepare(getGameInfo($gameid));
                                            $result = $sth->execute();
                                            if ($sth->rowCount() <= 0) {
                                                die;
                                            }
                                            while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
                                                if (strtolower($row["name"]) == strtolower($_SESSION["bnet_username"]) and strtolower($_SESSION["bnet_username"]) != strtolower($Player)) {
                                                    $CanRate = 1;
                                                }
                                            }
                                            if (isset($CanRate)) {
                                                $sth = $db->prepare("SELECT COUNT(*) FROM " . OSDB_GPR . " \n\t\tWHERE player='" . $Player . "' AND voter = '" . $voter . "' AND gameid = '" . $gameid . "'");
                                                $result = $sth->execute();
                                                $r = $sth->fetch(PDO::FETCH_NUM);
                                                $numrows = $r[0];
                                                if ($numrows >= 1) {
Пример #6
0
function ArcadeFavorite()
{
    global $scripturl, $txt, $db_prefix, $modSettings, $context, $user_info, $smcFunc;
    $xml = isset($_REQUEST['xml']);
    is_not_guest();
    if (empty($modSettings['arcadeEnableFavorites']) || !($game = getGameInfo((int) $_REQUEST['game']))) {
        fatal_lang_error('arcade_game_not_found', false);
    }
    // It's favorite so we can remove it
    if ($game['is_favorite']) {
        $remove = true;
        $smcFunc['db_query']('', '
			DELETE FROM {db_prefix}arcade_favorite
			WHERE id_member = {int:member}
				AND id_game = {int:game}', array('game' => $game['id'], 'member' => $user_info['id']));
        // Update favorites count
        $request = $smcFunc['db_query']('', '
			SELECT COUNT(*)
			FROM {db_prefix}arcade_favorite
			WHERE id_game = {int:game}
			GROUP BY id_game', array('game' => $game['id']));
        list($num_favorites) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);
        updateGame($game['id'], array('num_favorites' => $num_favorites));
        if ($xml) {
            ArcadeXMLOutput(array('message' => &$txt['arcade_favorite_removed'], 'state' => 0));
        }
    } else {
        $remove = false;
        $smcFunc['db_insert']('insert', '{db_prefix}arcade_favorite', array('id_member' => 'int', 'id_game' => 'int'), array($user_info['id'], $game['id']), array());
        // Update favorites count
        updateGame($game['id'], array('num_favorites' => '+'));
        if ($xml) {
            ArcadeXMLOutput(array('message' => $txt['arcade_favorite_added'], 'state' => 1));
        }
    }
    redirectexit('?action=arcade;sa=highscore;game=' . $game['id']);
}
Пример #7
0
function ArcadeVbGetGame()
{
    global $scripturl, $context, $modSettings, $smcFunc;
    return getGameInfo($_SESSION['arcade']['play_vb3g'][$_POST['id']]);
}
Пример #8
0
    if ($crypt == 'hash_md5' || $crypt == 'hash_authme' || $crypt == 'hash_xauth' || $crypt == 'hash_cauth' || $crypt == 'hash_joomla' || $crypt == 'hash_wordpress' || $crypt == 'hash_dle') {
        $row = mysql_fetch_assoc(mysql_query("SELECT {$db_columnUser},{$db_columnPass} FROM {$db_table} WHERE {$db_columnUser}='{$_POST['user']}'"));
        $realPass = $row[$db_columnPass];
    }
    if ($crypt == 'hash_ipb' || $crypt == 'hash_vbulletin') {
        $row = mysql_fetch_assoc(mysql_query("SELECT {$db_columnUser},{$db_columnPass},{$db_columnOther} FROM {$db_table} WHERE {$db_columnUser}='{$_POST['user']}'"));
        $realPass = $row[$db_columnPass];
        $salt = $row[$db_columnOther];
    }
    if ($crypt == 'hash_xenforo') {
        $row = mysql_fetch_assoc(mysql_query("SELECT {$db_table}.{$db_table}.{$db_columnUser},{$db_tableOther}.{$db_tableOther}.{$db_columnPass} FROM {$db_table}, {$db_tableOther} WHERE {$db_table}.{$db_columnId} = {$db_tableOther}.{$db_columnId} AND {$db_table}.{$db_columnUser}='{$_POST['user']}'"));
        $realPass = substr($row[$db_columnPass], 22, 64);
        $salt = substr($row[$db_columnPass], 105, 64);
    }
    if ($realPass) {
        $checkPass = $crypt();
        if (strcmp($realPass, $checkPass) == 0) {
            $sessid = generateSessionId();
            $gamebuild = getGameInfo('build');
            mysql_query("UPDATE {$db_table} SET {$db_columnSesId}='{$sessid}' WHERE {$db_columnUser} = '{$login}'") or die("Запрос к базе завершился ошибкой.");
            $dlticket = md5($login);
            echo $gamebuild . ':' . $dlticket . ':' . $login . ':' . $sessid . ':';
        } else {
            echo "Bad login";
        }
    } else {
        echo "Bad login";
    }
} else {
    echo 'Old version';
}
Пример #9
0
function ArcadeHighscore()
{
    global $scripturl, $txt, $db_prefix, $modSettings, $context, $smcFunc, $user_info, $sourcedir;
    // Is game set
    if (!isset($_REQUEST['game'])) {
        fatal_lang_error('arcade_game_not_found', false);
    }
    // Get game info
    if (!($game = getGameInfo($_REQUEST['game']))) {
        fatal_lang_error('arcade_game_not_found', false);
    }
    if (!$game['highscore_support']) {
        fatal_lang_error('arcade_game_not_found', false);
    }
    $newScore = false;
    // Did we just play
    if (isset($_SESSION['arcade']['highscore']['game']) && $_SESSION['arcade']['highscore']['game'] == $game['id']) {
        // For highlight
        $newScore = $_SESSION['arcade']['highscore']['saved'];
        $newScore_id = $_SESSION['arcade']['highscore']['id'];
        $context['arcade']['submit'] = 'newscore';
        $score =& $_SESSION['arcade']['highscore'];
        $context['arcade']['new_score'] = array('id' => $score['id'], 'saved' => $score['saved'], 'error' => !empty($score['error']) ? $score['error'] : '', 'score' => comma_format((double) $score['score']), 'position' => isset($score['position']) ? $score['position'] : 0, 'can_comment' => $context['arcade']['can_comment_own'] || $context['arcade']['can_comment_any'], 'is_new_champion' => !empty($score['newChampion']), 'is_personal_best' => !empty($score['personalBest']));
        if (!isset($_GET['start'])) {
            $_REQUEST['start'] = $score['start'];
        }
    } elseif (isset($_SESSION['arcade']['highscore'])) {
        unset($_SESSION['arcade']['highscore']);
    }
    // Edit Comment
    if (isset($_REQUEST['csave'])) {
        if (isset($_SESSION['arcade']['highscore'])) {
            unset($_SESSION['arcade']['highscore']);
        }
        require_once $sourcedir . '/Subs-Post.php';
        $where = $context['arcade']['can_comment_any'] ? '1 = 1' : ($context['arcade']['can_comment_own'] ? 'id_member = {int:member}' : '0 = 1');
        $_REQUEST['new_comment'] = strtr($smcFunc['htmlspecialchars']($_REQUEST['new_comment'], ENT_QUOTES), array("\r" => '', "\n" => '', "\t" => ''));
        preparsecode($_REQUEST['new_comment']);
        if (!empty($modSettings['arcadeCommentLen'])) {
            $_REQUEST['new_comment'] = substr($_REQUEST['new_comment'], 0, $modSettings['arcadeCommentLen']);
        }
        $smcFunc['db_query']('', '
			UPDATE {db_prefix}arcade_scores
			SET comment = {string:comment}
			WHERE id_score = {int:score}
				AND ' . $where, array('score' => (int) $_REQUEST['score'], 'comment' => $_REQUEST['new_comment'], 'member' => $user_info['id']));
        $_SESSION['arcade']['highscore']['saved'] = true;
        if (isset($_REQUEST['xml'])) {
            ArcadeXMLOutput(array('comment' => parse_bbc($_REQUEST['new_comment']), 'message' => $txt['arcade_comment_saved']), null);
        }
        redirectexit('action=arcade;sa=highscore;game=' . $game['id']);
    } elseif ($context['arcade']['can_admin_arcade'] && isset($_REQUEST['qaction'])) {
        checkSession('request');
        if ($_REQUEST['qaction'] == 'delete' && !empty($_REQUEST['scores'])) {
            deleteScores($game, $_REQUEST['scores']);
        }
        redirectexit('action=arcade;sa=highscore;game=' . $game['id']);
    }
    // How many scores there are
    $result = $smcFunc['db_query']('', '
		SELECT COUNT(*)
		FROM {db_prefix}arcade_scores
		WHERE id_game = {int:game}', array('game' => $game['id']));
    list($scoreCount) = $smcFunc['db_fetch_row']($result);
    $smcFunc['db_free_result']($result);
    $context['page_index'] = constructPageIndex($scripturl . '?action=arcade;sa=highscore;game=' . $game['id'], $_REQUEST['start'], $scoreCount, $context['scores_per_page'], false);
    // Actual query
    $result = $smcFunc['db_query']('', '
		SELECT
			sc.id_score, sc.score, sc.end_time AS time, sc.duration, sc.comment,
			sc.position, sc.score_status, IFNULL(mem.id_member, 0) AS id_member,
			IFNULL(mem.real_name, sc.player_name) AS real_name
		FROM  {db_prefix}arcade_scores AS sc
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = sc.id_member)
		WHERE id_game = {int:game}
		ORDER BY position
		LIMIT {int:start}, {int:scores_per_page}', array('game' => $game['id'], 'empty' => '', 'start' => $_REQUEST['start'], 'scores_per_page' => $context['scores_per_page']));
    $context['arcade']['scores'] = array();
    $context['game'] = $game;
    while ($score = $smcFunc['db_fetch_assoc']($result)) {
        censorText($score['comment']);
        if (empty($score['real_name'])) {
            $score['real_name'] = $txt['guest'];
        }
        $context['arcade']['scores'][$score['id_score']] = array('id' => $score['id_score'], 'own' => $user_info['id'] == $score['id_member'], 'member' => array('id' => $score['id_member'], 'name' => $score['real_name'], 'link' => !empty($score['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $score['id_member'] . '">' . $score['real_name'] . '</a>' : $score['real_name']), 'position' => $score['position'], 'score' => comma_format((double) $score['score']), 'time' => timeformat($score['time']), 'duration' => $score['duration'], 'scoreStatus' => $score['score_status'], 'comment' => parse_bbc(!empty($score['comment']) ? $score['comment'] : $txt['arcade_no_comment']), 'raw_comment' => $score['comment'], 'can_edit' => $user_info['id'] == $score['id_member'] ? $context['arcade']['can_comment_own'] || $context['arcade']['can_comment_any'] : $context['arcade']['can_comment_any']);
    }
    $smcFunc['db_free_result']($result);
    if (isset($_REQUEST['edit'])) {
        if ($context['arcade']['scores'][(int) $_REQUEST['score']]['can_edit']) {
            $context['arcade']['scores'][(int) $_REQUEST['score']]['edit'] = true;
        }
    }
    if ($newScore) {
        $context['arcade']['scores'][$newScore_id]['highlight'] = true;
    }
    // Template
    loadTemplate('ArcadeGame');
    $context['template_layers'][] = 'arcade_game';
    $context['sub_template'] = 'arcade_game_highscore';
    $context['page_title'] = sprintf($txt['arcade_view_highscore'], $game['name']);
    $context['linktree'][] = array('url' => $scripturl . '?action=arcade;sa=play;game=' . $game['id'], 'name' => $game['name']);
    $context['linktree'][] = array('url' => $scripturl . '?action=arcade;sa=highscore;game=' . $game['id'], 'name' => $txt['arcade_viewscore']);
    // Do we show remove score functions?
    $context['arcade']['show_editor'] = $context['arcade']['can_admin_arcade'];
    return true;
}
Пример #10
0
 //END REPLAY
 $temp_points = 0;
 $temp_kills = 0;
 $temp_assists = 0;
 $temp_deaths = 0;
 $temp_ck = 0;
 $temp_cd = 0;
 $counter = 0;
 $ScourgeRow = 0;
 $SentinelRow = 0;
 if (file_exists("inc/geoip/geoip.inc")) {
     include "inc/geoip/geoip.inc";
     $GeoIPDatabase = geoip_open("inc/geoip/GeoIP.dat", GEOIP_STANDARD);
     $GeoIP = 1;
 }
 $sth = $db->prepare(getGameInfo((int) $gameid));
 $result = $sth->execute();
 if ($sth->rowCount() <= 0) {
     require_once OS_PLUGINS_DIR . 'index.php';
     os_init();
     header('location: ' . OS_HOME . '?404&game=not_found');
     die;
 }
 while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
     $GameData[$c]["hideElement"] = "";
     if ($row["newcolour"] <= 5) {
         $GameData[$c]["counter"] = $row["newcolour"];
     }
     if ($row["newcolour"] > 5) {
         $GameData[$c]["counter"] = $row["newcolour"] - 1;
     }
Пример #11
0
function getRecommendedGames($id_game)
{
    global $db_prefix, $user_info, $smcFunc;
    if (!is_array($id_game)) {
        $id_game = array($id_game);
    }
    $request = $smcFunc['db_query']('', '
		SELECT sc.id_member, COUNT(*) as plays
		FROM {db_prefix}arcade_scores AS sc
		WHERE sc.id_game IN({array_int:games})
		GROUP BY sc.id_member
		ORDER BY plays DESC
		LIMIT 50', array('games' => $id_game));
    $players = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $players[] = $row['id_member'];
    }
    $smcFunc['db_free_result']($request);
    if (empty($players)) {
        return false;
    }
    $request = $smcFunc['db_query']('', '
		SELECT sc.id_game, COUNT(*) AS plays
		FROM {db_prefix}arcade_scores AS sc
			LEFT JOIN {db_prefix}arcade_games AS game ON (game.id_game = sc.id_game)
			LEFT JOIN {db_prefix}arcade_categories AS category ON (category.id_cat = game.id_cat)
		WHERE {query_see_game}
			AND sc.id_member IN({array_int:players})
			AND game.id_game NOT IN({array_int:games})
		GROUP BY sc.id_game
		ORDER BY plays DESC
		LIMIT 3', array('players' => $players, 'games' => $id_game));
    $recommended = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        if ($id_game == $row['id_game']) {
            continue;
        }
        $recommended[] = getGameInfo($row['id_game']);
    }
    $smcFunc['db_free_result']($request);
    return $recommended;
}