Beispiel #1
0
     // Params: action, sid, gameid
     ////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////
 // switchrealtime
 // Params: action, sid, gameid
 ////////////////////////////////////////////////////////////////////////////////////////////
 case "switchrealtime":
     if (isSessionIDValid($config, $xsid)) {
         $session = base64_decode($xsid);
         list($uniq, $player_id) = preg_split("/\\|/", $session);
         if ($_GET['gameid'] != "") {
             //Instantiate theCR3DCQuery Class
             $oR3DCQuery = new CR3DCQuery($config);
             $isblack = $oR3DCQuery->IsPlayerBlack($config, $_GET['gameid'], $player_id);
             if ($isblack) {
                 $oR3DCQuery->RealTimeGame($config, $_GET['gameid'], "b");
             } else {
                 $oR3DCQuery->RealTimeGame($config, $_GET['gameid'], "w");
             }
             $oR3DCQuery->Close();
             unset($oR3DCQuery);
             echo "<RESPONSE>\n";
             echo "<SETRT>true</SETRT>\n";
             echo "</RESPONSE>\n";
         } else {
             echo "<RESPONSE>\n";
             echo "<SETRT>false</SETRT>\n";
             echo "</RESPONSE>\n";
         }
     } else {
         echo "<RESPONSE>\n";
$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;
    }
}
?>