コード例 #1
0
ファイル: gaq.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['FirstCardNotMyTurn'] == 'NoCardSelected' or @$_POST['SecondCardNotMyTurn'] == 'NoCardSelected') {
        $mypage = page::standard();
        $mypage->title_body('Cards not selected');
        $mypage->leaf('p', 'You omitted to select a card in one or both of the selection lists. Please select a card in each list and then try again. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $FC = sanitise_int(@$_POST['FirstCardNotMyTurn'], SANITISE_NO_FLAGS, 0, $GAME['HandSize'][$GAME['MyColour']] - 1);
    $SC = sanitise_int(@$_POST['SecondCardNotMyTurn'], SANITISE_NO_FLAGS, 0, $GAME['HandSize'][$GAME['MyColour']] - 1);
    if ($FC == $SC) {
        $mypage = page::standard();
        $mypage->title_body('Same cards selected');
        $mypage->leaf('p', 'You selected the same card in each selection list. Please select a different card in each list and then try again. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $CardSwitch = $GAME['Cards'][$GAME['MyColour']][$FC];
    $GAME['Cards'][$GAME['MyColour']][$FC] = $GAME['Cards'][$GAME['MyColour']][$SC];
    $GAME['Cards'][$GAME['MyColour']][$SC] = $CardSwitch;
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully swapped cards.');
}
コード例 #2
0
ファイル: gac.php プロジェクト: hdp/brass
function DoTask()
{
    global $Administrator, $GAME;
    if (!$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Not authorised');
        $mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!@$_POST['CheckD']) {
        $mypage = page::standard();
        $mypage->title_body('Tick box left unticked');
        $mypage->leaf('p', 'The tick box was left unticked. You need to make sure the box is ticked - this is to prevent accidental use of the administrator controls. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot abort game');
        $mypage->leaf('p', 'This game cannot be aborted just now, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    abortgame(1);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully aborted game.');
}
コード例 #3
0
ファイル: gae.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot abort this game');
        $mypage->leaf('p', 'This game cannot be aborted just now, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to abort it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['AbortVoteActive']) {
        myerror($unexpectederrormessage, 'Unexpected vote page "gae.php" reached');
    }
    if ($GAME['CurrentPlayers'] - $GAME['PlayersMissing'] == 1) {
        abortgame(0);
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and aborted game.');
    }
    $GAME['AbortVote'][$GAME['MyColour']] = 1;
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            $subject = 'There is a vote to abort game number ' . $GAME['GameID'];
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to abort the game. In order for the game to be aborted, all of the players must agree; this means that a unanimous vote is required. Please visit the game\'s page and either vote in favour of aborting it, or shut the vote down by voting not to abort. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
コード例 #4
0
ファイル: gan.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot quit game');
        $mypage->leaf('p', 'You cannot presently quit this game, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game. You might be seeing this message because you clicked the button twice. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!@$_POST['CheckA'] or !@$_POST['CheckB']) {
        $mypage = page::standard();
        $mypage->title_body('Tick boxes left unticked');
        $mypage->leaf('p', 'One or both tick boxes were left unticked. You need to make sure both boxes are ticked - this is to prevent accidental use of the "quit" function. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['PlayersMissing'] + 1 == $GAME['CurrentPlayers']) {
        abortgame(0);
        dbformatgamedata();
        $mypage = page::standard();
        $mypage->title_body('Game aborted instead');
        $mypage->leaf('p', 'Since you were the only player left in the game, the game has instead been aborted. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    KickPlayer($GAME['MyColour'], 0);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully quit game.');
}
コード例 #5
0
ファイル: gak.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement' or !$GAME['PlayersMissingThatMatter']) {
        $mypage = page::standard();
        $mypage->title_body('No replacements needed');
        $mypage->leaf('p', 'No replacement players are needed for this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $mycol = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Colour" FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
    if ($mycol === 'NONE') {
        $mypage = page::standard();
        $mypage->title_body('Not currently a candidate replacement');
        $mypage->leaf('p', 'You are not currently a candidate replacement. You might be seeing this message because you clicked the button twice. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
    if ($mycol['Colour'] == $GAME['PlayerToMove']) {
        $GAME['AltGameTicker'] .= '8F' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']);
        $GAME['GameTickerNames'] .= '|' . $_SESSION['MyUserName'];
        dbformatgamedata();
    } else {
        dbquery(DBQUERY_COMMIT);
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully withdrew request.');
}
コード例 #6
0
ファイル: gal.php プロジェクト: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Current player is not missing');
        $mypage->leaf('p', 'The current player is not missing. (Perhaps somebody accepted a replacement player after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot choose replacement players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $ReplacementValid = false;
    for ($i = 0; $i < count($GAME['ReplacementOffers']); $i++) {
        if ($GAME['ReplacementOffers'][$i][2] == $GAME['PlayerToMove'] and $GAME['ReplacementOffers'][$i][0] == @$_POST['whotoaccept']) {
            $ReplacementValid = $i;
        }
    }
    if ($ReplacementValid === false) {
        $mypage = page::standard();
        $mypage->title_body('User ID not found among replacements');
        $mypage->leaf('p', 'The submitted user ID was not found among the candidate replacements. (Perhaps the user withdrew his request after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $QR = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Name", "Pronoun", "Email", "EmailPrompt" FROM "User" WHERE "UserID" = :user:'******'user', $GAME['ReplacementOffers'][$ReplacementValid][0]);
    if ($QR === 'NONE') {
        myerror($unexpectederrormessage, 'Candidate replacements list contains invalid user');
    }
    switch ($QR['Pronoun']) {
        case 'He':
            $RepPronoun = 'A';
            break;
        case 'She':
            $RepPronoun = 'B';
            break;
        default:
            $RepPronoun = 'C';
            break;
    }
    $GAME['AltGameTicker'] .= '8E' . callmovetimediff() . letter_end_number($GAME['ReplacementOffers'][$ReplacementValid][0]) . $RepPronoun . letter_end_number($GAME['MyColour']);
    $GAME['GameTickerNames'] .= '|' . $GAME['ReplacementOffers'][$ReplacementValid][1];
    $GAME['PlayerName'][$GAME['PlayerToMove']] = $QR['Name'];
    $GAME['KickVote'] = '00000';
    $GAME['GameStatus'] = 'In Progress';
    $GAME['MoveMade'] = 1;
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "Colour" = :colour:', 'game', $GAME['GameID'], 'colour', $GAME['PlayerToMove']);
    dbquery(DBQUERY_WRITE, 'INSERT INTO "PlayerGameRcd" ("User", "Game", "GameResult", "Inherited", "GameCounts", "Colour", "NumLongTurns", "CurrentOccupant") VALUES (:user:, :game:, \'Playing\', 1, :counts:, :colour:, 0, 0)', 'user', $GAME['ReplacementOffers'][$ReplacementValid][0], 'game', $GAME['GameID'], 'counts', $GAME['ReplacementOffers'][$ReplacementValid][3], 'colour', $GAME['PlayerToMove']);
    dbformatgamedata();
    if ($QR['EmailPrompt'] and $QR['Email'] != '') {
        $subject = 'Your request to join game number ' . $GAME['GameID'] . ' has been accepted';
        $body = '<p>This is an automated message. One of the players in game number ' . $GAME['GameID'] . ' has accepted your request to join the game as a replacement player. This means that it is now your turn to move; please visit the game\'s page and take your turn. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
        send_email($subject, $body, $QR['Email'], null);
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully accepted replacement.');
}
コード例 #7
0
ファイル: gah.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to remove players from this game');
        $mypage->leaf('p', 'At the moment you cannot vote to remove players from this game. This might be because the game has finished, or it might be because the game is seeking a replacement player. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to remove players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == $GAME['PlayerToMove']) {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to kick yourself');
        $mypage->leaf('p', 'You cannot vote to kick yourself. If you want to leave the game, please select the option to "Quit" instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['CanKickVote']) {
        $mypage = page::standard();
        $mypage->title_body('Kick vote not currently available');
        $mypage->leaf('p', 'The option to vote to kick the current player is not presently available. (Perhaps the player you were waiting for took his turn in the meantime.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['KickVoteActive']) {
        $mypage = page::standard();
        $mypage->title_body('No vote is taking place');
        $mypage->leaf('p', 'At present, no vote on kicking the current player is taking place. (Perhaps the player you were waiting for took his turn in the meantime, or perhaps another player voted against.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['votevalueA']) {
        if ($GAME['PlayersVotingToKick'] - $GAME['IHaveKickVoted'] + 2 >= $GAME['CurrentPlayers']) {
            $NameOfKickedPlayer = $GAME['PlayerFullName'][$GAME['PlayerToMove']];
            KickPlayer($GAME['PlayerToMove'], 2);
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and kicked player.');
        }
        $GAME['KickVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['KickVote'] = '00000';
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '' and $i != $GAME['PlayerToMove']) {
            $subject = 'The vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . 'from game number ' . $GAME['GameID'] . ' has failed';
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has voted against kicking ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from the game. In order for ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . ' to be kicked, all of the players must agree; this means that a unanimous vote is required. So, ' . $GAME['PronounLC'][$GAME['PlayerToMove']] . ' will not be kicked at this time. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
コード例 #8
0
ファイル: gai.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME, $PlayersVotingToKick;
    if ($GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to downsize this game');
        $mypage->leaf('p', 'This game is not currently seeking a replacement player, so you cannot vote to downsize it. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['CurrentPlayers'] == 3) {
        $mypage = page::standard();
        $mypage->title_body('Cannot downsize a 3-player game');
        $mypage->leaf('p', 'At present, it is not permitted for a 3-player game to be downsized. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['CurrentPlayers'] == $GAME['MinimumPlayersAllowed'] and $GAME['MinimumPlayersAllowed'] > 2) {
        $mypage = page::standard();
        $mypage->title_body('Cannot downsize from this number of players');
        $mypage->leaf('p', 'This game cannot be downsized, as the game board in use does not support fewer than ' . $GAME['MinimumPlayersAllowed'] . ' players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to downsize it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['DSVote'] == 'Yes') {
        if ($GAME['PlayersVotingToKick'] - $GAME['IHaveKickVoted'] + 1 >= $GAME['CurrentPlayers']) {
            require HIDDEN_FILES_PATH . 'downsizeresource.php';
            downsizegame(false);
            $didsomething = 1;
            while ($didsomething) {
                $didsomething = gamecheck();
            }
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and downsized game.');
        }
        $GAME['KickVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        if (!$GAME['KickVoteActive']) {
            for ($i = 0; $i < MAX_PLAYERS; $i++) {
                if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and !$GAME['PlayersVotingToKick'] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
                    $subject = 'There is a vote to downsize game number ' . $GAME['GameID'];
                    $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to downsize the game instead of recruiting a replacement player. In order for the game to be downsized, all of the players must agree; this means that a unanimous vote is required. If you would like the game to be downsized, then please visit the game\'s page and vote in favour of downsizing. If you do not want the game to be downsized, then no action is required other than to accept a replacement if one asks to join. (You will be emailed if this happens. Bear in mind that if a replacement is not found before the Time Limit B for this game is exceeded, then the game will be downsized anyway.) Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
                    send_email($subject, $body, $GAME['Email'][$i], null);
                }
            }
        }
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['KickVote'][$GAME['MyColour']] = 0;
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
コード例 #9
0
ファイル: gag.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'In Progress') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to remove players from this game');
        $mypage->leaf('p', 'At the moment you cannot vote to remove players from this game. This might be because the game has finished, or it might be because the game is seeking a replacement player. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to remove players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == $GAME['PlayerToMove']) {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to kick yourself');
        $mypage->leaf('p', 'You cannot vote to kick yourself. If you want to leave the game, please select the option to "Quit" instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['CanKickVote']) {
        $mypage = page::standard();
        $mypage->title_body('Kick vote not currently available');
        $mypage->leaf('p', 'The option to vote to kick the current player is not presently available. (Perhaps the player you were waiting for took his turn in the meantime.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['KickVoteActive']) {
        myerror($unexpectederrormessage, 'Unexpected vote page "gag.php" reached');
    }
    if ($GAME['CurrentPlayers'] - $GAME['PlayersMissing'] == 2) {
        $NameOfKickedPlayer = $GAME['PlayerFullName'][$GAME['PlayerToMove']];
        KickPlayer($GAME['PlayerToMove'], 2);
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and kicked player.');
    }
    $GAME['KickVote'][$GAME['MyColour']] = 1;
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            if ($i == $GAME['PlayerToMove']) {
                $subject = 'There is a vote to kick you from game number ' . $GAME['GameID'];
                $body = 'This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to kick you from the game, as you are taking a long time to make your move. In order for you to be kicked, all of the other players must agree; this means that a unanimous vote is required. However, you can end the vote immediately by taking your turn. Please visit the game\'s page and shut the vote down by taking your turn. Here is the URL of the game page:' . "\n\n" . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . EMAIL_FOOTER;
            } else {
                $subject = 'There is a vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from game number ' . $GAME['GameID'];
                $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from the game, as ' . $GAME['PronounLC'][$GAME['PlayerToMove']] . ' is taking a long time to make ' . $GAME['PossessivePronounLC'][$GAME['PlayerToMove']] . ' move. In order for ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . ' to be kicked, all of the players must agree; this means that a unanimous vote is required. Please visit the game\'s page and either vote in favour of kicking ' . $GAME['PlayerName'][$GAME['PlayerToMove']] . ', or shut the vote down by voting not to kick ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . '. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            }
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
コード例 #10
0
ファイル: gar.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    sort($GAME['Cards'][$GAME['MyColour']]);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully sorted cards.');
}
コード例 #11
0
ファイル: gad.php プロジェクト: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    $AdminKickList = sanitise_int(@$_POST['AdminKickList']);
    $PostFailureTitle = false;
    do {
        if (!$Administrator) {
            $PostFailureTitle = 'Not authorised';
            $PostFailureMessage = 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!@$_POST['CheckC']) {
            $PostFailureTitle = 'Tick box left unticked';
            $PostFailureMessage = 'The tick box was left unticked. You need to make sure the box is ticked - this is to prevent accidental use of the administrator controls. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
            $PostFailureTitle = 'Cannot kick player';
            $PostFailureMessage = 'Players cannot be kicked right now, perhaps because the game has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($AdminKickList < 0 or $AdminKickList >= MAX_PLAYERS) {
            $PostFailureTitle = 'Invalid input';
            $PostFailureMessage = 'Expected an integer between 0 and ' . (MAX_PLAYERS - 1) . ' inclusive, but received ' . $AdminKickList . '. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$GAME['PlayerExists'][$AdminKickList] or $GAME['PlayerMissing'][$AdminKickList]) {
            $PostFailureTitle = 'Seat is empty';
            $PostFailureMessage = 'The chosen seat is empty, or the chosen colour does not exist in this game. Perhaps the player was kicked in the meantime. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['PlayersMissing'] + 1 == $GAME['CurrentPlayers']) {
            $PostFailureTitle = 'Only one player is not missing';
            $PostFailureMessage = 'This is the only player who is not missing. If you do not want the game to continue, please select to abort it instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    KickPlayer($AdminKickList, 1);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully kicked player.');
}
コード例 #12
0
ファイル: gaf.php プロジェクト: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot abort this game');
        $mypage->leaf('p', 'This game cannot be aborted just now, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to abort it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['AbortVoteActive']) {
        $mypage = page::standard();
        $mypage->title_body('No vote is taking place');
        $mypage->leaf('p', 'At present, no vote on aborting the game is taking place. Perhaps somebody voted against aborting the game in the meantime. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['votevalue']) {
        if ($GAME['PlayersVotingToAbort'] - $GAME['IHaveAbortVoted'] + 1 >= $GAME['CurrentPlayers']) {
            abortgame(0);
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and aborted game.');
        }
        $GAME['AbortVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['AbortVote'] = '00000';
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            $subject = 'The vote to abort game number ' . $GAME['GameID'] . ' has failed';
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has voted against aborting the game. In order for the game to be aborted, all of the players must agree; this means that a unanimous vote is required. So, the game will not be aborted at this time. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
コード例 #13
0
ファイル: mt.php プロジェクト: hdp/brass
                        } else {
                            if ($GAME['GameStatus'] == 'Recruiting Replacement') {
                                abortgame(2);
                            } else {
                                KickPlayer($GAME['PlayerToMove'], 3);
                            }
                        }
                    }
                }
            }
            $GAME['MoveMade'] = 1;
            $didsomething = 1;
            while ($didsomething) {
                $didsomething = gamecheck();
            }
            dbformatgamedata();
        }
        $OutputLines[] = 'Games timed out: ' . count($gamestimedout) . ', namely ' . implode(', ', $gamestimedout);
        sleep(2);
        // Be nice
    }
}
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
// 2. Zero "bad login attempt" counts.
dbquery(DBQUERY_WRITE, 'UPDATE "User" SET "BadAttempts" = "BadAttempts" - 1 WHERE "BadAttempts" > 0');
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
// 3. *** Cancel games that are "Recruiting" and were created more than 7 days ago.
コード例 #14
0
ファイル: gaj.php プロジェクト: hdp/brass
function DoTask()
{
    global $Banned, $GAME;
    if (@$_POST['Counts']) {
        $ToCount = 1;
    } else {
        $ToCount = 0;
    }
    if ($GAME['RailPhase']) {
        $ToCount = 0;
    }
    $ChosenColour = sanitise_int(@$_POST['colourtoreplace'], SANITISE_NO_FLAGS, 0, MAX_PLAYERS - 1);
    $PostFailureTitle = false;
    do {
        if (!$GAME['PlayersMissing']) {
            $PostFailureTitle = 'No missing players';
            $PostFailureMessage = 'There aren\'t any players missing from this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement' or !$GAME['PlayersMissingThatMatter']) {
            $PostFailureTitle = 'No replacements needed';
            $PostFailureMessage = 'No replacement players are needed for this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$GAME['PlayerMissingAndMatters'][$ChosenColour]) {
            $PostFailureTitle = 'Cannot join as selected colour';
            $PostFailureMessage = 'You cannot join this game as the selected colour. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['MyColour'] != 50) {
            $PostFailureTitle = 'Already playing in this game';
            $PostFailureMessage = 'You cannot join this game as a replacement, because you are already playing in it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($Banned) {
            $PostFailureTitle = 'Banned';
            $PostFailureMessage = 'You cannot join this game as a replacement, because you are banned. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (in_array($_SESSION['MyUserID'], $GAME['ReplacementOffers_Users'])) {
            $PostFailureTitle = 'Request already received';
            $PostFailureMessage = 'You have already made a request to join this game. You might be seeing this message because you clicked the button twice. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (dbquery(DBQUERY_READ_RESULTSET, 'SELECT "User" FROM "PlayerGameRcd" WHERE "User" = :user: AND "Game" = :game:', 'user', $_SESSION['MyUserID'], 'game', $GAME['GameID']) !== 'NONE') {
            $PostFailureTitle = 'You have previously played in this game';
            $PostFailureMessage = 'You have previously played in this game. It is not possible to re-join the game. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'INSERT INTO "ReplacementOffer" ("Game", "User", "Colour", "ToCount") VALUES (:game:, :user:, :colour:, :tocount:)', 'game', $GAME['GameID'], 'user', $_SESSION['MyUserID'], 'colour', $ChosenColour, 'tocount', $ToCount);
    if ($ChosenColour == $GAME['PlayerToMove']) {
        $GAME['AltGameTicker'] .= '8A' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']);
        $GAME['GameTickerNames'] .= '|' . $_SESSION['MyUserName'];
        dbformatgamedata();
        for ($i = 0; $i < MAX_PLAYERS; $i++) {
            if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
                $subject = $_SESSION['MyUserName'] . ' wants to join game number ' . $GAME['GameID'] . ' as a replacement';
                $body = '<p>This is an automated message. ' . $_SESSION['MyUserName'] . ' has asked to join game number ' . $GAME['GameID'] . ' as a replacement. As you are playing in this game, you can choose to accept this request. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
                send_email($subject, $body, $GAME['Email'][$i], null);
            }
        }
    } else {
        dbformatgamedata();
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully requested to join.');
}
コード例 #15
0
ファイル: gas.php プロジェクト: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $PersonActing, $SystemActing, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'In Progress') {
        echo '<html><head><title>' . transtext('memCannotMoveT') . '</title><body>' . str_replace('\\gameid', $GAME['GameID'], transtext('memCannotMoveM')) . '</body></html>';
        die;
    }
    if ($GAME['PlayerToMove'] == $GAME['MyColour'] or $Administrator and @$_POST['AdminMoveYes']) {
        if ($_POST['ProgressDigit'] != $GAME['NumMovesMade']) {
            echo '<html><head><title>' . transtext('memCheckIntegerT') . '</title></head><body>' . str_replace('\\gameid', $GAME['GameID'], transtext('memCheckIntegerM')) . '</body></html>';
            exit;
        }
        if (!isset($_POST['LinkToBuild'])) {
            $formdetails['LinkToBuild'] = 50;
        } else {
            if ($_POST['LinkToBuild'] == 'StopBuilding') {
                $formdetails['LinkToBuild'] = 50;
            } else {
                $formdetails['LinkToBuild'] = (int) $_POST['LinkToBuild'];
                if ($formdetails['LinkToBuild'] < 0 or $GAME['RailPhase'] and $formdetails['LinkToBuild'] >= $GAME['NumRailLinks'] or !$GAME['RailPhase'] and ($formdetails['LinkToBuild'] >= $GAME['NumCanalLinks'] or ($GAME['ModularBoardParts'] & 8) == 0 and $formdetails['LinkToBuild'] == 12 and $GAME['GVersion'] == 1)) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if (!isset($_POST['FirstCard'])) {
            $formdetails['CardA'] = 9;
        } else {
            if ($_POST['FirstCard'] == 'NoCardSelected') {
                $formdetails['CardA'] = 9;
            } else {
                $formdetails['CardA'] = (int) $_POST['FirstCard'];
                if ($formdetails['CardA'] < 0 or $formdetails['CardA'] > 7) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if (!isset($_POST['SecondCard'])) {
            $formdetails['CardB'] = 9;
        } else {
            if ($_POST['SecondCard'] == 'NoCardSelected') {
                $formdetails['CardB'] = 9;
            } else {
                $formdetails['CardB'] = (int) $_POST['SecondCard'];
                if ($formdetails['CardB'] < 0 or $formdetails['CardB'] > 7) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if (!isset($_POST['MoveType'])) {
            $formdetails['MoveType'] = 0;
        } else {
            if ($_POST['MoveType'] == 9) {
                echo '<html><head><title>' . transtext('memNoMoveTypeT') . '</title></head><body>' . str_replace('\\gameid', $GAME['GameID'], transtext('memNoMoveTypeM')) . '</body></html>';
                die;
            } else {
                $formdetails['MoveType'] = (int) $_POST['MoveType'];
                if ($formdetails['MoveType'] < 0 or $formdetails['MoveType'] > 6) {
                    die(transtext('memBadMoveData'));
                }
                if ($GAME['HandSize'][$GAME['PlayerToMove']] == 2 and ($formdetails['MoveType'] == 1 or $formdetails['MoveType'] == 6)) {
                    $formdetails['CardA'] = 0;
                    $formdetails['CardB'] = 1;
                }
            }
        }
        if ($formdetails['MoveType'] == 6 and !$_POST['PassSure']) {
            echo '<html><head><title>' . transtext('memBoxUntickedT') . '</title><body>' . str_replace('\\gameid', $GAME['GameID'], transtext('memBoxUntickedM')) . '</body></html>';
            die;
        }
        if (!isset($_POST['TileType0'])) {
            $TileT[0] = 9;
        } else {
            $TileT[0] = (int) $_POST['TileType0'];
        }
        if (!isset($_POST['TileType1'])) {
            $TileT[1] = 9;
        } else {
            $TileT[1] = (int) $_POST['TileType1'];
        }
        if (!isset($_POST['TileType2'])) {
            $TileT[2] = 9;
        } else {
            $TileT[2] = (int) $_POST['TileType2'];
        }
        if (!isset($_POST['TileType3'])) {
            $TileT[3] = 9;
        } else {
            $TileT[3] = (int) $_POST['TileType3'];
        }
        if (!isset($_POST['TileType4'])) {
            $TileT[4] = 9;
        } else {
            $TileT[4] = (int) $_POST['TileType4'];
        }
        if (!isset($_POST['TileType5'])) {
            $TileT[5] = 9;
        } else {
            $TileT[5] = (int) $_POST['TileType5'];
        }
        if (!isset($_POST['TileType6'])) {
            $TileT[6] = 9;
        } else {
            $TileT[6] = (int) $_POST['TileType6'];
        }
        if (!isset($_POST['TileType7'])) {
            $TileT[7] = 9;
        } else {
            $TileT[7] = (int) $_POST['TileType7'];
        }
        if (!isset($_POST['TileTypeY'])) {
            $TileTY = 9;
        } else {
            $TileTY = (int) $_POST['TileTypeY'];
        }
        if (!isset($_POST['TileType'])) {
            $TileTX = 9;
        } else {
            if ($_POST['TileType'] == 'StopDeveloping') {
                $TileTX = 9;
            } else {
                $TileTX = (int) $_POST['TileType'];
                if ($TileTX < 0 or $TileTX > 4) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if ($GAME['SecondDevelopMode']) {
            $formdetails['TileType'] = $TileTX;
        } else {
            if ($formdetails['MoveType'] == 3) {
                $formdetails['TileType'] = $TileTX;
            } else {
                if ($formdetails['MoveType'] == 1) {
                    $formdetails['TileType'] = $TileTY;
                    if ($formdetails['TileType'] < 0 or $formdetails['TileType'] > 4) {
                        die(transtext('memBadMoveData'));
                    }
                } else {
                    if (!$GAME['ContinueSellingMode'] and !$GAME['SecondRailMode'] and !$GAME['DebtMode']) {
                        if ($formdetails['CardA'] != 9) {
                            $formdetails['TileType'] = $TileT[$formdetails['CardA']];
                            if ($formdetails['TileType'] < 0 or $formdetails['TileType'] > 4) {
                                die(transtext('memBadMoveData'));
                            }
                        }
                    }
                }
            }
        }
        if (!isset($_POST['IndustrySpace0'])) {
            $IndSp[0] = 50;
        } else {
            $IndSp[0] = (int) $_POST['IndustrySpace0'];
        }
        if (!isset($_POST['IndustrySpace1'])) {
            $IndSp[1] = 50;
        } else {
            $IndSp[1] = (int) $_POST['IndustrySpace1'];
        }
        if (!isset($_POST['IndustrySpace2'])) {
            $IndSp[2] = 50;
        } else {
            $IndSp[2] = (int) $_POST['IndustrySpace2'];
        }
        if (!isset($_POST['IndustrySpace3'])) {
            $IndSp[3] = 50;
        } else {
            $IndSp[3] = (int) $_POST['IndustrySpace3'];
        }
        if (!isset($_POST['IndustrySpace4'])) {
            $IndSp[4] = 50;
        } else {
            $IndSp[4] = (int) $_POST['IndustrySpace4'];
        }
        if (!isset($_POST['IndustrySpace5'])) {
            $IndSp[5] = 50;
        } else {
            $IndSp[5] = (int) $_POST['IndustrySpace5'];
        }
        if (!isset($_POST['IndustrySpace6'])) {
            $IndSp[6] = 50;
        } else {
            $IndSp[6] = (int) $_POST['IndustrySpace6'];
        }
        if (!isset($_POST['IndustrySpace7'])) {
            $IndSp[7] = 50;
        } else {
            $IndSp[7] = (int) $_POST['IndustrySpace7'];
        }
        if (!isset($_POST['IndustrySpaceY'])) {
            $IndSpY = 50;
        } else {
            $IndSpY = (int) $_POST['IndustrySpaceY'];
        }
        if (!isset($_POST['IndustrySpace'])) {
            $IndSpX = 50;
            if ($GAME['DebtMode']) {
                die(transtext('memBadMoveData'));
            }
        } else {
            if ($_POST['IndustrySpace'] == 'StopSelling') {
                $IndSpX = 50;
                if ($GAME['DebtMode']) {
                    die(transtext('memBadMoveData'));
                }
            } else {
                $IndSpX = (int) $_POST['IndustrySpace'];
                if ($IndSpX < 0 or $IndSpX >= $GAME['NumIndustrySpaces']) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if ($GAME['DebtMode'] or $GAME['ContinueSellingMode']) {
            $formdetails['IndustrySpace'] = $IndSpX;
        } else {
            if ($formdetails['MoveType'] == 5) {
                $formdetails['IndustrySpace'] = $IndSpX;
            } else {
                if ($formdetails['MoveType'] == 1) {
                    $formdetails['IndustrySpace'] = $IndSpY;
                    if ($formdetails['IndustrySpace'] < 0 or $formdetails['IndustrySpace'] >= $GAME['NumIndustrySpaces']) {
                        die(transtext('memBadMoveData'));
                    }
                } else {
                    if (!$GAME['SecondDevelopMode'] and !$GAME['SecondRailMode']) {
                        $formdetails['IndustrySpace'] = $IndSp[$formdetails['CardA']];
                        if ($formdetails['IndustrySpace'] < 0 or $formdetails['IndustrySpace'] >= $GAME['NumIndustrySpaces']) {
                            die(transtext('memBadMoveData'));
                        }
                    }
                }
            }
        }
        if (!isset($_POST['CoalSource'])) {
            $formdetails['CoalSource'] = 50;
        } else {
            if ($_POST['CoalSource'] == 'DemandTrack') {
                $formdetails['CoalSource'] = 50;
            } else {
                $formdetails['CoalSource'] = (int) $_POST['CoalSource'];
                if ($formdetails['CoalSource'] < 0 or $formdetails['CoalSource'] >= $GAME['NumIndustrySpaces']) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if (!isset($_POST['IronSource'])) {
            $formdetails['IronSource'] = 50;
        } else {
            if ($_POST['IronSource'] == 'DemandTrack') {
                $formdetails['IronSource'] = 50;
            } else {
                $formdetails['IronSource'] = (int) $_POST['IronSource'];
                if ($formdetails['IronSource'] < 0 or $formdetails['IronSource'] >= $GAME['NumIndustrySpaces']) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if (!isset($_POST['PortSpace'])) {
            $formdetails['PortSpace'] = 50;
        } else {
            if ($_POST['PortSpace'] == 'DistantMarket') {
                $formdetails['PortSpace'] = 50;
            } else {
                $formdetails['PortSpace'] = (int) $_POST['PortSpace'];
                if ($formdetails['PortSpace'] < 0 or $formdetails['PortSpace'] >= $GAME['NumIndustrySpaces']) {
                    die(transtext('memBadMoveData'));
                }
            }
        }
        if (!isset($_POST['LoanAmount'])) {
            $formdetails['LoanAmount'] = 3;
        } else {
            $formdetails['LoanAmount'] = (int) $_POST['LoanAmount'];
            if ($formdetails['LoanAmount'] < 1 or $formdetails['LoanAmount'] > 3) {
                die(transtext('memBadMoveData'));
            }
        }
        $SystemActing = false;
        $PersonActing = $_SESSION['MyUserID'];
        $ColourMoving = $GAME['PlayerToMove'];
        $errorlist = moveexecute($formdetails);
        $SystemActing = true;
        if ($errorlist == '') {
            $didsomething = 1;
            while ($didsomething) {
                $didsomething = gamecheck();
            }
            dbformatgamedata();
            echo "<html><head><title>Move Executed</title><script type=\"text/javascript\"><!--\nfunction delayer(){\nwindow.location =\"board.php?GameID={$GAME['GameID']}\"\n}\n//-->\n</script>\n</head><body onLoad=\"setTimeout('delayer()', 2000)\">" . str_replace('\\gameid', $GAME['GameID'], transtext('moveSuccess'));
            if ($GAME['GameStatus'] != 'In Progress' or $GAME['PlayerToMove'] != $ColourMoving) {
                echo ' ' . str_replace('\\userid', $_SESSION['MyUserID'], transtext('moveAlternateLk'));
                // "Alternatively, click _here_" etc
            }
            echo ')<p><font color="#';
            if ($GAME['GameStatus'] == 'In Progress' and $GAME['PlayerToMove'] == $ColourMoving) {
                echo 'FF0000"><b>' . transtext('moveStillYou');
            } else {
                echo '00BB00"><b>';
                if ($GAME['RailPhase'] and $GAME['Round'] == $GAME['NumRounds'] and !$GAME['DebtMode'] and $GAME['GameStatus'] != 'Finished') {
                    $ReferenceTurnOrder = array_flip(str_split($GAME['TurnOrder'], 1));
                    if ($ReferenceTurnOrder[$ColourMoving] > $ReferenceTurnOrder[$GAME['PlayerToMove']]) {
                        echo transtext('moveNoLongerYou');
                    } else {
                        echo transtext('moveYouAreDone');
                    }
                } else {
                    if ($GAME['GameStatus'] != 'Finished') {
                        echo transtext('moveNoLongerYou');
                    } else {
                        // This last "else" is redundant, I think, but I'll leave it as I can't be bothered to make sure of that
                        echo transtext('moveYouAreDone');
                    }
                }
            }
            echo '</b></font></body></html>';
        } else {
            echo '<html><head><title>' . transtext('memProblemsT') . '</title><body>' . str_replace(array('\\errorlist', '\\gameid'), array($errorlist, $GAME['GameID']), transtext('memProblemsM')) . '</body></html>';
        }
    } else {
        if ($Administrator) {
            echo '<html><head><title>You did not select the tick box</title><body>You did not select the tick box to indicate that you want to intervene in the current player\'s turn. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the game.</body></html>';
        } else {
            if ($GAME['MyColour'] != 50) {
                die($unexpectederrormessage);
            } else {
                echo '<html><head><title>' . transtext('memNotYourGameT') . '</title><body>' . str_replace('\\gameid', $GAME['GameID'], transtext('memNotYourGameM')) . '</body></html>';
            }
        }
    }
}