예제 #1
0
파일: APgame.php 프로젝트: CSchool/AIBattle
<?php

include_once 'procedures.php';
$_SESSION['adminPanelState'] = 'APgame.php';
if (isAdmin()) {
    $gameId = -1;
    if (isset($_GET['game'])) {
        $gameId = intval($_GET['game']);
    }
    $_SESSION['adminGameId'] = $gameId;
    $gameList = getGameList();
    $currentGame = getGameList($gameId);
    $vizualize = @getVisualizerByGame($gameId);
    ?>

    <script>
        changeActiveAdminButton('gameButton');
    </script>

    <script>
        function loadGameData(gameId)
        {
            $('#dataContainer').load('APgame.php?game=' + gameId);
        }

        function loadFormData()
        {
            var gameSelector = document.getElementById('gameSelector');
            var gameSelectorValue = gameSelector.options[gameSelector.selectedIndex].value;
            
            var gameName = document.getElementById('gameName').value;
예제 #2
0
파일: duels.php 프로젝트: CSchool/AIBattle
<?php

include_once "procedures.php";
if ($_GET['round']) {
    $roundId = intval($_GET['round']);
} else {
    $roundId = -1;
}
$_SESSION['tournamentState'] = 'duels.php';
$_SESSION['tournamentDuel'] = $roundId;
$gameId = intval($_GET['game']);
$userId = isAdmin() && isset($_GET['uid']) ? intval($_GET['id']) : getActiveUserID();
$page = isset($_GET['page']) ? intval($_GET['page']) : 0;
$visual = getVisualizerByGame($gameId);
$tournamentId = intval($_GET['tournament']);
$duels = getDuels($roundId, $gameId, $userId, $tournamentId, $page * 10, 10);
?>

<h3><?php 
echo getDuelHeader($roundId, $gameId);
?>
</h3>
Страница:
<br />
<div class="btn-group">
<?php 
$limit = getDuelsCount($roundId, $gameId, $userId, $tournamentId);
$skipped = false;
for ($i = 0; $i < $limit; $i += 10) {
    $p = intval($i / 10);
    if (abs($p - $page) <= 2 || $i == 0 || $i + 10 >= $limit) {
예제 #3
0
<?php

include_once 'procedures.php';
?>
<html>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <head>
        <script src="js/jquery-1.10.2.min.js"></script>
    </head>
    <body>
        <div class = "container content">
        <center>
        <?php 
$duel = intval($_GET['duel']);
$gameId = getGameByDuel($duel);
if (getVisualizerByGame($gameId) && isActiveUserHasAccessToDuel($duel)) {
    $file = file("./logs/{$duel}.txt");
    $log = "";
    $s = current($file);
    while ($s !== false) {
        if (strpos($s, "OK") === 0 || strpos($s, "IM") === 0) {
            while ($s !== false && $s != "END_OF_OUTPUT\n") {
                $s = next($file);
            }
        } else {
            if ($s == "FIELD\n") {
                $s = next($file);
                while ($s !== false && $s != "END_OF_FIELD\n") {
                    $log .= trim($s) . "\\n";
                    $s = next($file);
                }