Пример #1
0
}
$isexitrealtime = false;
$isdraw = $oR3DCQuery->IsRequestDraw($config, $gid, $isblack);
$cmdExitRealtime = $_GET['cmdExitRealtime'];
if ($cmdExitRealtime != "") {
    $oR3DCQuery->ExitRealTimeGame($config, $gid);
    $isexitrealtime = true;
    $_SESSION['RealTimeDoOnce'] = 0;
}
$rtend = $_GET['rtend'];
if ($rtend == 1) {
    $isexitrealtime = true;
    $_SESSION['RealTimeDoOnce'] = 0;
}
$cmdSwitchRealtime = $_GET['cmdSwitchRealtime'];
$oR3DCQuery->ManageRealTimeGame($config, $gid);
if ($cmdSwitchRealtime != "") {
    if ($isblack) {
        $oR3DCQuery->RealTimeGame($config, $gid, "b");
    } else {
        $oR3DCQuery->RealTimeGame($config, $gid, "w");
    }
}
$isrealtime = $oR3DCQuery->IsRequestRealTime($config, $gid, $isblack);
if ($txtChatMessage != "" && $cmdChat != "") {
    if ($_SESSION['CHAT_MESSAGE'] != $txtChatMessage) {
        $txtChatMessage = str_replace("\\'", "'", $txtChatMessage);
        $txtChatMessage = str_replace("\\`", "'", $txtChatMessage);
        $message = "<" . $_SESSION['user'] . "> " . $txtChatMessage;
        $oR3DCQuery->SendGChat($ConfigFile, $gid, $message);
        $_SESSION['CHAT_MESSAGE'] = $txtChatMessage;
Пример #2
0
<?php 
////////////
//Instantiate theCR3DCQuery Class
$oR3DCQuery = new CR3DCQuery($config);
$isblack = $oR3DCQuery->IsPlayerBlack($config, $GID, $_SESSION['id']);
$isdraw = $oR3DCQuery->IsRequestDraw($config, $GID, $isblack);
$initiator = "";
$w_player_id = "";
$b_player_id = "";
$status = "";
$completion_status = "";
$start_time = "";
$next_move = "";
$oR3DCQuery->GetGameInfoByRef($config, $GID, $initiator, $w_player_id, $b_player_id, $status, $completion_status, $start_time, $next_move);
$oR3DCQuery->ManageRealTimeGame($config, $GID);
$isrealtime = $oR3DCQuery->IsRequestRealTime($config, $GID, $isblack);
if ($isrealtime == "IDS_REAL_TIME") {
    //Refresh the game board
    if ($_SESSION['RefreashGameOnlyOnce'] == "") {
        echo "parent.frames['chessboard'].location='./chess_game2.php?gameid=" . $GID . "';";
        $_SESSION['RefreashGameOnlyOnce'] = "1";
    }
    //////////////////
    // Update player seconds
    if ($oR3DCQuery->IsPlayersTurn($config, $_SESSION['id'], $GID) && $oR3DCQuery->IsTimedGameRestricted($GID)) {
        $oR3DCQuery->UpdatePlayerTime($GID, $isblack, 10);
    }
    if ($completion_status == "I" && $oR3DCQuery->IsTimedGameRestricted($GID)) {
        $oR3DCQuery->PlayerTimeConstreached($GID, $w_player_id, $b_player_id);
    }