本文整理汇总了PHP中CR3DCQuery::IsRequestRealTime方法的典型用法代码示例。如果您正苦于以下问题:PHP CR3DCQuery::IsRequestRealTime方法的具体用法?PHP CR3DCQuery::IsRequestRealTime怎么用?PHP CR3DCQuery::IsRequestRealTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CR3DCQuery
的用法示例。
在下文中一共展示了CR3DCQuery::IsRequestRealTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
//.........这里部分代码省略.........
$timing_mode = (int) mysql_result($return, 0, "time_mode");
$m1 = (int) @mysql_result($return, $i, 'moves1');
$m2 = (int) @mysql_result($return, $i, 'moves2');
$t1 = (int) @mysql_result($return, $i, 'time1') * 60;
$t2 = (int) @mysql_result($return, $i, 'time2') * 60;
//$timing_type = mysql_result($return, 0, "o_timetype");
$game_update = array();
if ($timing_mode == 1) {
$now = time();
//$timetype = substr(trim(strtolower($timing_type)), 2);
// If time controls are used, get the number of moves to work out which time control
// applies. If a time control has been reached, remove the required time to the player's
// 'used' time.
if ($m1) {
$query = "SELECT count(*) as `count` FROM move_history WHERE game_id = '{$gid}' AND player_id = {$player_id}";
$return = mysql_query($query) or die(mysql_error());
$move_cnt = mysql_result($return, 0, 'count');
if ($move_cnt == $m1) {
if ($next_color == 'b') {
$w_time_used -= $t1;
} elseif ($next_color == 'w') {
$b_time_used -= $t1;
}
} elseif ($move_cnt > $m1) {
if (($move_cnt - $m1) % $m2 == 0) {
if ($next_color == 'b') {
$w_time_used -= $t2;
} elseif ($next_color == 'w') {
$b_time_used -= $t2;
}
}
}
}
// Get the 2nd last move's time. Subtract the move's time from the current time to work
// out how long it took the player to make this move. The first move made doesn't
// attract any time usage.
$query = "SELECT `time` FROM move_history WHERE game_id = '{$gid}' ORDER BY `time` DESC LIMIT 1,1";
$return = mysql_query($query) or die(mysql_error());
$num = mysql_numrows($return);
if ($num != 0) {
$last_move_time = (int) trim(mysql_result($return, 0, "time"));
} else {
$last_move_time = $now;
$game_update[] = "start_time = {$now}";
}
$diff = $now - $last_move_time;
if ($next_color == 'w') {
$game_update[] = "b_time_used=" . ($b_time_used + $diff);
} else {
$game_update[] = "w_time_used=" . ($w_time_used + $diff);
}
}
$game_update[] = "next_move='{$next_color}'";
$game_update = implode(', ', $game_update);
$st = "UPDATE game SET {$game_update} WHERE game_id='" . $gid . "'";
//echo "run $st";
//exit();
mysql_query($st) or die(mysql_error());
$st = "INSERT INTO message_queue(player_id, message, posted) VALUES(" . $other_player . ",'" . $this->add_header("M", $move_stat . $this->zero_pad($player_id, 8) . $gid . $move, "0") . "'," . time() . ")";
mysql_query($st) or die(mysql_error());
//////////////////////////////////////////////
//Instantiate theCR3DCQuery Class
$oR3DCQuery = new CR3DCQuery($this->ChessCFGFileLocation);
$isblack = $oR3DCQuery->IsPlayerBlack($this->ChessCFGFileLocation, $gid, $other_player);
$isrealtime = $oR3DCQuery->IsRequestRealTime($this->ChessCFGFileLocation, $gid, $isblack);
if ($oR3DCQuery->MoveNotification($other_player) == true && $isrealtime != "IDS_REAL_TIME") {
$requestorname = $oR3DCQuery->GetUserIDByPlayerID($this->ChessCFGFileLocation, $player_id);
$otherguysname = $oR3DCQuery->GetUserIDByPlayerID($this->ChessCFGFileLocation, $other_player);
$otheremail = $oR3DCQuery->GetEmailByPlayerID($this->ChessCFGFileLocation, $other_player);
$subject = $this->GetStringFromStringTable("IDS_CR3DCQUERY_EMAIL_TVST_17", $ConfigFile);
$aTags1 = array("['otherguysname']", "['requestorname']", "['gid']", "['move']", "['siteurl']", "['sitename']");
$aReplaceTags1 = array($otherguysname, $requestorname, $gid, $move, $this->TrimRSlash($conf['site_url']), $conf['site_name']);
$bodyp1 = str_replace($aTags1, $aReplaceTags1, $this->GetStringFromStringTable("IDS_CR3DCQUERY_EMAIL_TVST_18", $ConfigFile));
$this->SendEmail($otheremail, $conf['registration_email'], $conf['site_name'], $subject, $bodyp1);
}
unset($oR3DCQuery);
//////////////////////////////////////////////
//////////////////////////////////////////////
//Check if the king was killed
//////////////////////////////////////////////
$FEN = $this->request_FEN($this->ChessCFGFileLocation, $gid);
$Moves = "";
$RestOfSentence = "";
list($Moves, $RestOfSentence) = preg_split("/ /", $FEN);
$nwhitek = strpos($Moves, 'k');
if ($nwhitek === false) {
$st = "UPDATE game SET status='C', completion_status='B' WHERE game_id='" . $gid . "'";
mysql_query($st) or die(mysql_error());
}
$nblackk = strpos($Moves, 'K');
if ($nblackk === false) {
$st = "UPDATE game SET status='C', completion_status='W' WHERE game_id='" . $gid . "'";
mysql_query($st) or die(mysql_error());
}
//////////////////////////////////////////////
$move_stat = "S";
}
}
return $move_stat . $this->zero_pad($player_id, 8) . $gid . $move;
}
示例2: list
// realtimestatus
// Params: action, sid, gameid
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
// realtimestatus
// Params: action, sid, gameid
////////////////////////////////////////////////////////////////////////////////////////////
case "realtimestatus":
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);
$status = $oR3DCQuery->IsRequestRealTime($ConfigFile, $_GET['gameid'], $isblack);
$oR3DCQuery->Close();
unset($oR3DCQuery);
echo "<RESPONSE>\n";
echo "<RTSTATUS>" . $status . "</RTSTATUS>\n";
echo "</RESPONSE>\n";
} else {
echo "<RESPONSE>\n";
echo "<RTSTATUS></RTSTATUS>\n";
echo "</RESPONSE>\n";
}
} else {
echo "<RESPONSE>\n";
echo "<ERROR>IDS_SESSION_ID_INVALID</ERROR>\n";
echo "</RESPONSE>\n";
}
示例3: GetStringFromStringTable
}
$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;
}
}
?>
<html>
<head>
<title><?php
echo GetStringFromStringTable("IDS_PAGETITLES_23", $config);