function isSessionIDValid($config, $xsid) { $bValid = false; //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $oR3DCQuery->CheckSIDTimeout(); if ($xsid != "") { if ($oR3DCQuery->CheckLogin($config, $xsid)) { $session = base64_decode($xsid); list($uniq, $player_id) = preg_split("/\\|/", $session); if ($uniq != "" && is_numeric($player_id)) { $bValid = true; $oR3DCQuery->UpdateSIDTimeout($config, $xsid); $oR3DCQuery->SetPlayerCreditsInit($player_id); } } } if ($oR3DCQuery->ELOIsActive()) { $oR3DCQuery->ELOCreateRatings(); } $oR3DCQuery->MangeGameTimeOuts(); $oR3DCQuery->Close(); unset($oR3DCQuery); return $bValid; }
} else { if ($oR3DCQuery->TGameStatus($GID)) { $oR3DCQuery->GetTGameBoard($config, $GID, $_SESSION['sid'], $_SESSION['id'], $clrl, $clrd); if ($oR3DCQuery->IsPlayersTurn($config, $_SESSION['id'], $GID)) { //echo "Its, ".$_SESSION['user']." turn to play."; echo str_replace("['user']", $_SESSION['user'], GetStringFromStringTable("IDS_TGAME_TXT_3", $config)); } } else { echo "<br>" . GetStringFromStringTable("IDS_TGAME_TXT_3", $config) . ""; } } $oR3DCQuery->Close(); unset($oR3DCQuery); } else { //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); if ($oR3DCQuery->TimeForTGame($config, $GID) == false) { echo "<br>" . GetStringFromStringTable("IDS_TGAME_TXT_1", $config) . ""; } else { if ($oR3DCQuery->TGameStatus($GID)) { $oR3DCQuery->GetTGameBoard($config, $GID, "", 0, $clrl, $clrd); } else { echo "<br>" . GetStringFromStringTable("IDS_TGAME_TXT_2", $config) . ""; } } $oR3DCQuery->Close(); unset($oR3DCQuery); } ?> </body>
////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CTipOfTheDay.php"; require $Root_Path . "bin/CBilling.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "bin/config.php"; ////////////////////////////////////////////////////////////// //Instantiate the Classes $oR3DCQuery = new CR3DCQuery($config); $oBilling = new CBilling($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// $RequiresPayment = $oBilling->IsPaymentEnabled(); if (!$bCronEnabled) { if ($oR3DCQuery->ELOIsActive()) { $oR3DCQuery->ELOCreateRatings(); } $oR3DCQuery->MangeGameTimeOuts(); } if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) { $user = trim($_POST['txtName']); $pass = trim($_POST['txtPassword']); if ($user != "" && $pass != "") { $sid = $oR3DCQuery->Login($user, $pass);
require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CAdmin.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; $config = $Root_Path . "bin/config.php"; $oAdmin = new CAdmin($config); $db_host = $conf['database_host']; $db_dbnm = $conf['database_name']; $db_user = $conf['database_login']; $db_pass = $conf['database_pass']; $db_link = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_dbnm); ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); // $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// //////////////////////////////////////////////// //Login Processing //////////////////////////////////////////////// //Check if admin is logged in already if (!isset($_SESSION['LOGIN'])) { $login = "******"; header('Location: ./index.php'); } else { if ($_SESSION['LOGIN'] != true) { if (isset($_SESSION['UNAME'])) { unset($_SESSION['UNAME']); } if (isset($_SESSION['LOGIN'])) {
unset($oSkins); ////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CTipOfTheDay.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// //Check if the logged in user has access if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) { $_SESSION['PageRef'] = $url; header('Location: ./chess_login.php'); } else { $oR3DCQuery->CheckSIDTimeout(); if ($oR3DCQuery->CheckLogin($config, $_SESSION['sid']) == false) { $_SESSION['PageRef'] = $url; header('Location: ./chess_login.php'); } else { $_SESSION['PageRef'] = ""; $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']);
////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "../skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CAdmin.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// //////////////////////////////////////////////// //Login Processing //////////////////////////////////////////////// //Check if admin is logged in already if (!isset($_SESSION['LOGIN'])) { $login = "******"; header('Location: ./index.php'); } else { if ($_SESSION['LOGIN'] != true) { if (isset($_SESSION['UNAME'])) { unset($_SESSION['UNAME']); } if (isset($_SESSION['LOGIN'])) {
//Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "../skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CAdmin.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; require $Root_Path . "includes/xml.php"; ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// if (!$bCronEnabled) { if ($oR3DCQuery->ELOIsActive()) { $oR3DCQuery->ELOCreateRatings(); } $oR3DCQuery->MangeGameTimeOuts(); } // GET and POST variables $tid = $_GET['tid']; $type = $_GET['type']; ?> <html> <head>
if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// include $Root_Path . "includes/support_chess.inc"; include $Root_Path . "includes/chess.inc"; require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CTipOfTheDay.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; require $Root_Path . "bin/LanguageParser.php"; include $config; // To access config options in this file. ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// // Check For the nonempty SID var $sid = trim($_GET['sid']); // Log the user on or manage the session if a SID is passed to the page if ($sid != "") { $user = ""; $id = ""; $oR3DCQuery->ConfirmSID($sid, $user, $id); if ($user != "" && $id != "") { $_SESSION['sid'] = $sid; $_SESSION['user'] = $user; $_SESSION['id'] = $id; $oR3DCQuery->GetChessBoardColors($config, $_SESSION['id'], $l, $d);
$SkinName = $oSkins->getskinname(); $oSkins->Close(); unset($oSkins); ////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/language.php"; //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $tid = $_GET['tid']; $type = $_GET['type']; ?> <html> <head> <title></title> <link rel="stylesheet" href="<?php echo $Root_Path . "skins/" . $SkinName . "/"; ?> layout.css" type="text/css"> </head> <body> <?php
$SkinName = $oSkins->getskinname(); $oSkins->Close(); unset($oSkins); ////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/language.php"; //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $tgc = $_GET['tgc']; $tid = $_GET['tid']; $type = $_GET['type']; $tzn = $_GET['tzn']; ?> <html> <head> <title></title> <link rel="stylesheet" href="<?php echo $Root_Path . "skins/" . $SkinName . "/"; ?> layout.css" type="text/css"> </head> <body>
$SkinName = $oSkins->getskinname(); $oSkins->Close(); unset($oSkins); ////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/language.php"; //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $tgc = $_GET['tgc']; $tid = $_GET['tid']; $type = $_GET['type']; $tzn = $_GET['tzn']; if (isset($_SESSION['sid'])) { $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']); $oR3DCQuery->v2OTMJoinAndMaintainChatStatus($type, $tid, $_SESSION['id']); } ?> <html> <head> <title></title> <link rel="stylesheet" href="<?php echo $Root_Path . "skins/" . $SkinName . "/";
include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "includes/language.php"; $bLogedin = false; $bUsernameChanged = false; $strErrorMsg = ""; $strNewUserName = ""; $cmdViewUsername = $_POST['cmdViewUsername']; $txtOldUsername = $_POST['txtOldUsername']; $txtPassword = $_POST['txtPassword']; $cmdChangeUsername = $_POST['cmdChangeUsername']; $txtNewUsername = $_POST['txtNewUsername']; //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); // Log the user in if (($cmdViewUsername != "" || $cmdChangeUsername) && $txtOldUsername != "" && $txtPassword != "") { $strNewUserName = $oR3DCQuery->CheckUserNameLogin($txtOldUsername, $txtPassword); if ($strNewUserName != "") { $bLogedin = true; } } // Change the users old username if ($cmdChangeUsername != "" && $txtNewUsername != "" && $txtPassword != "" && $txtOldUsername != "" && $bLogedin) { if ($oR3DCQuery->IsUserNameLegal($txtNewUsername)) { if (!$oR3DCQuery->UserNameExists($txtNewUsername)) { if ($oR3DCQuery->ChangeUserNameByOldName($strNewUserName, $txtNewUsername)) { $bUsernameChanged = true; } } else {
$SkinName = $oSkins->getskinname(); $oSkins->Close(); unset($oSkins); ////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/language.php"; //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $tgc = $_GET['tgc']; $tid = $_GET['tid']; $type = $_GET['type']; $tzn = $_GET['tzn']; $clrl = $_SESSION['lcolor']; $clrd = $_SESSION['dcolor']; if ($clrl == "" && $clrd == "") { $clrl = "#957A01"; $clrd = "#FFFFFF"; } ?> <html> <head> <title></title>
//Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "../skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CAdmin.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; require $Root_Path . "includes/xml.php"; ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// //////////////////////////////////////////////// //Login Processing //////////////////////////////////////////////// //Check if admin is logged in already if (!isset($_SESSION['LOGIN'])) { $login = "******"; header('Location: ./index.php'); } else { if ($_SESSION['LOGIN'] != true) { if (isset($_SESSION['UNAME'])) { unset($_SESSION['UNAME']); } if (isset($_SESSION['LOGIN'])) {
if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CTipOfTheDay.php"; require $Root_Path . "bin/CBilling.php"; require $Root_Path . "bin/CServMsg.php"; require $Root_Path . "includes/language.php"; require $Root_Path . "includes/siteconfig.php"; include_once $Root_Path . "bin/CAvatars.php"; require $Root_Path . "bin/LanguageParser.php"; include $config; ////////////////////////////////////////////////////////////// //Instantiate the Classes $oR3DCQuery = new CR3DCQuery($config); $oAvatars = new CAvatars($config); $oBilling = new CBilling($config); $oServMsg = new CServMsg($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// // Check For the nonempty SID var $sid = trim($_GET['sid']); // Log the user on or manage the session if a SID is passed to the page if ($sid != "") { $user = ""; $id = ""; $oR3DCQuery->ConfirmSID($sid, $user, $id); if ($user != "" && $id != "") { $_SESSION['sid'] = $sid;
$my_color = trim($_GET['my_color']); $fen = trim($_GET['fen']); $otherplayerid = trim($_GET['otherplayerid']); $cmdCreateGame = trim($_GET['cmdCreateGame']); $chkrealtime = 1; $chkrealtimeposs = ""; $move1 = trim($_GET['txtmoves1']); $time1 = trim($_GET['txtmins1']); $move2 = trim($_GET['txtmoves2']); $time2 = trim($_GET['txtmins2']); $precreate = trim($_GET['slc_precreate']); $slctGameRating = trim($_GET['slctGameRating']); $slctGameTime = trim($_GET['slctGameTime']); ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// //Check if the logged in user has access if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) { $_SESSION['PageRef'] = $url; header('Location: ./chess_login.php'); } else { $oR3DCQuery->CheckSIDTimeout(); if ($oR3DCQuery->CheckLogin($config, $_SESSION['sid']) == false) { $_SESSION['PageRef'] = $url; header('Location: ./chess_login.php'); } else { $_SESSION['PageRef'] = ""; $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']);
//Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); if ($oR3DCQuery->IsPlayersTurn($config, $_SESSION['id'], $GID) && $oR3DCQuery->TimeForTGame($config, $GID)) { echo "parent.frames['chessboard'].location.reload();"; } elseif ($oR3DCQuery->IsPlayersTurn($config, $_SESSION['id'], $GID) == false && $oR3DCQuery->TimeForTGame($config, $GID) == false) { echo "parent.frames['chessboard'].location.reload();"; } elseif ($oR3DCQuery->TGameStatus($GID) == false) { echo "parent.frames['chessboard'].location.reload();"; } $oR3DCQuery->Close(); unset($oR3DCQuery); /////////// ?> </script> <body> <textarea cols='32' rows='24' class='post'> <?php //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $oR3DCQuery->GetTChat($config, $GID); $oR3DCQuery->Close(); unset($oR3DCQuery); ?> </textarea> </body> </html>
function create_game($ConfigFile, $requestor, $other, $req_color, $FEN) { if ($other !== "") { if ($requestor == $other) { return ""; } // verify the validity of both players $w_player_id = ""; $b_player_id = ""; if ($req_color != "" && $req_color == "w") { $w_player_id = $requestor; $b_player_id = $other; } else { $w_player_id = $other; $b_player_id = $requestor; } //include config file include $ConfigFile; // create a new game in the db $game_id = $this->gen_unique(); // connect to mysql and open database $db_my = mysql_connect($conf['database_host'], $conf['database_login'], $conf['database_pass']) or die("Couldn't connect to the database."); @mysql_select_db($conf['database_name']) or die("Unable to select database"); $st = "INSERT INTO game(game_id, initiator, w_player_id, b_player_id, start_time) VALUES('" . $game_id . "'," . $requestor . "," . $w_player_id . "," . $b_player_id . "," . time() . ")"; mysql_query($st) or die(mysql_error()); //if fen is included insert it if (trim($FEN) != "") { $st = "INSERT INTO c4m_newgameotherfen VALUES('" . $game_id . "', '" . trim($FEN) . "')"; mysql_query($st) or die(mysql_error()); } // immediately update the status of the requestor $st = "UPDATE player SET status='E' WHERE player_id=" . $requestor . ""; mysql_query($st) or die(mysql_error()); ////////////////////////////////////////////// // notify the challenged $st = "INSERT INTO message_queue(player_id, message, posted) VALUES(" . $other . ",'" . $this->add_header("G", $game_id . $this->zero_pad($requestor, 8), "C") . "'," . time() . ")"; mysql_query($st) or die(mysql_error()); //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($this->ChessCFGFileLocation); if ($oR3DCQuery->ChallangeNotification($other) == true) { $requestorname = $oR3DCQuery->GetUserIDByPlayerID($this->ChessCFGFileLocation, $requestor); $otherguysname = $oR3DCQuery->GetUserIDByPlayerID($this->ChessCFGFileLocation, $other); $otheremail = $oR3DCQuery->GetEmailByPlayerID($this->ChessCFGFileLocation, $other); $subject = $this->GetStringFromStringTable("IDS_CR3DCQUERY_EMAIL_TVST_19", $ConfigFile); $aTags1 = array("['otherguysname']", "['requestorname']", "['game_id']", "['siteurl']", "['sitename']"); $aReplaceTags = array($otherguysname, $requestorname, $game_id, $this->TrimRSlash($conf['site_url']), $conf['site_name']); $bodyp1 = str_replace($aTags1, $aReplaceTags, $this->GetStringFromStringTable("IDS_CR3DCQUERY_EMAIL_TVST_20", $ConfigFile)); $this->SendEmail($otheremail, $conf['registration_email'], $conf['site_name'], $subject, $bodyp1); } unset($oR3DCQuery); ////////////////////////////////////////////// return $game_id . $this->zero_pad($w_player_id, 8) . $this->zero_pad($b_player_id, 8); } else { return ""; } }
$SkinName = $oSkins->getskinname(); $oSkins->Close(); unset($oSkins); ////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/language.php"; //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $jtime = $_GET['jtime']; if (isset($_SESSION['sid'])) { $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']); $oR3DCQuery->PlayerChatJoinAndMaintainChatStatus($_SESSION['id']); } ?> <html> <head> <title></title> <link rel="stylesheet" href="<?php echo $Root_Path . "skins/" . $SkinName . "/"; ?> layout.css" type="text/css"> </head>
////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CTipOfTheDay.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; require $Root_Path . "bin/CAdmin.php"; ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) { $user = trim($_POST['txtName']); $pass = trim($_POST['txtPassword']); if ($user != "" && $pass != "") { $sid = $oR3DCQuery->Login($user, $pass); $id = $oR3DCQuery->GetIDByUserID($config, $user); if ($sid != "") { $_SESSION['sid'] = $sid; $_SESSION['user'] = $user; $_SESSION['id'] = $id; //Get Chessboard colors $d = ""; $l = "";
function mobile_get_game_update_on_state_change($xsid) { //$session = base64_decode($xsid); //list($uniq, $player_id) = preg_split("/\|/", $session); if ($_GET['gameid'] != "") { $game_id = $_GET['gameid']; try { $dbh = CSession::$dbh; $side_to_move = $_GET['side_to_move']; $get_game_over = (bool) $_GET['get_game_over']; $get_new_move = (bool) $_GET['get_new_move']; $with_full_update = (bool) $_GET['with_full_update']; $require_full_update = FALSE; $new_move = FALSE; // Work out whose turn it is. $player_w = -1; $player_b = -1; $next_move = ''; $stmt = $dbh->prepare("SELECT `w_player_id`,`b_player_id`,`next_move` FROM `game` WHERE `game_id` = ?"); $stmt->bind_param('s', $game_id); if ($stmt->execute()) { $stmt->bind_result($player_w, $player_b, $next_move); $result = $stmt->fetch(); if ($result) { if ($next_move == NULL) { $next_move = 'w'; } // Game creation does not initially set a next move value. Assume white to move as custom game setup isn't yet implemented. } $stmt->close(); } else { echo "<ERROR>Database Error</ERROR>\n"; return false; } if ($get_new_move) { //echo "next $next_move , side $side_to_move"; if ($next_move != $side_to_move) { echo "<NEW_MOVE>true</NEW_MOVE>\n"; $new_move = TRUE; $require_full_update = TRUE; } else { echo "<NEW_MOVE>false</NEW_MOVE>\n"; } } if ($get_game_over) { // See if the game is over (because the opponent resigned, there was a draw or a player won). $game_result = 0; $stmt = $dbh->prepare("SELECT `completion_status` FROM `game` WHERE `game_id` = ?"); $stmt->bind_param('s', $game_id); if ($stmt->execute()) { $stmt->bind_result($status); $result = $stmt->fetch(); if ($result) { if ($status == "W") { $game_result = 1; } elseif ($status == "B") { $game_result = 2; } elseif ($status == "D") { $game_result = 3; } } $stmt->close(); } else { echo "<ERROR>Database Error</ERROR>\n"; return false; } if ($game_result != 0) { echo "<GAME_OVER>true</GAME_OVER>\n"; $require_full_update = TRUE; } else { echo "<GAME_OVER>false</GAME_OVER>\n"; } } if ($require_full_update && $with_full_update) { // There might be cases where we only want to know if a move was made or the game is over without the details of the game state. mobile_get_full_game_update(); } if ($new_move) { $move = ChessHelper::get_last_move(); echo "<MOVE_SAN>" . $move['SAN'] . "</MOVE_SAN>\n"; echo "<MOVE_FROM>" . $move['from'] . "</MOVE_FROM>\n"; echo "<MOVE_TO>" . $move['to'] . "</MOVE_TO>\n"; } // Return the draw status. $session = base64_decode($xsid); list($uniq, $player_id) = preg_split("/\\|/", $session); $oR3DCQuery = new CR3DCQuery($Root_Path . "bin/config.php"); $isblack = $oR3DCQuery->IsPlayerBlack($Root_Path . "bin/config.php", $game_id, $player_id); $isdraw = $oR3DCQuery->IsRequestDraw($Root_Path . "bin/config.php", $game_id, $isblack); echo "<DRAWCODE>"; echo $isdraw; echo "</DRAWCODE>\n"; } catch (mysqli_sql_exception $e) { echo "<ERROR>Database Connection Error</ERROR>\n"; return false; } } else { echo "<ERROR>IDS_GAME_ID_INVALID</ERROR>\n"; } }
//Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "../skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CAdmin.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; require $Root_Path . "bin/LanguageParser.php"; ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// //////////////////////////////////////////////// //Login Processing //////////////////////////////////////////////// //Check if admin is logged in already if (!isset($_SESSION['LOGIN'])) { $login = "******"; header('Location: ./index.php'); } else { if ($_SESSION['LOGIN'] != true) { if (isset($_SESSION['UNAME'])) { unset($_SESSION['UNAME']); } if (isset($_SESSION['LOGIN'])) {
$SkinName = $oSkins->getskinname(); $oSkins->Close(); unset($oSkins); ////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/language.php"; //Instantiate theCR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $tid = $_GET['tid']; $type = $_GET['type']; $slctPlayerCutOffDateMonth = trim($_GET['slctPlayerCutOffDateMonth']); $slctPlayerCutOffDateDay = trim($_GET['slctPlayerCutOffDateDay']); $slctPlayerCutOffDateYear = trim($_GET['slctPlayerCutOffDateYear']); $txtCutOfftimeH = trim($_GET['txtCutOfftimeH']); $txtCutOfftimeM = trim($_GET['txtCutOfftimeM']); $txtCutOfftimeS = trim($_GET['txtCutOfftimeS']); $cmdCreateGames = $_GET['cmdCreateGames']; $strError = ""; $bAdded = false; if ($cmdCreateGames != "" && $oR3DCQuery->v2IsOTMTournamentGamesCreated($type, $tid) == false) { if ($type == 1) { $oR3DCQuery->v2GetTournamentInformation_OneToMany($tid, $strname, $strdescription, $nplayercutoffdate, $ntournamentstartdate, $ntournamentenddate, $strtimezone, $strgametimeout, $nplayersignuptype, $strdateadded, $strstatus, $aTOrganizers, $aTPlayers); }
//Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "./skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// include $Root_Path . "includes/support_chess.inc"; include $Root_Path . "includes/chess.inc"; require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CTipOfTheDay.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// // Check For the nonempty SID var $sid = trim($_GET['sid']); // Log the user on or manage the session if a SID is passed to the page if ($sid != "") { $user = ""; $id = ""; $oR3DCQuery->ConfirmSID($sid, $user, $id); if ($user != "" && $id != "") { $_SESSION['sid'] = $sid; $_SESSION['user'] = $user; $_SESSION['id'] = $id; } else {
////////////////////////////////////////////////////////////// //Skin - standard includes ////////////////////////////////////////////////////////////// $SSIfile = "../skins/" . $SkinName . "/standard_cfg.php"; if (file_exists($SSIfile)) { include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CAdmin.php"; include_once $Root_Path . "bin/CAvatars.php"; require $Root_Path . "bin/config.php"; require $Root_Path . "includes/siteconfig.php"; ////////////////////////////////////////////////////////////// //Instantiate the Classes $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// //////////////////////////////////////////////// //Login Processing //////////////////////////////////////////////// //Check if admin is logged in already if (!isset($_SESSION['LOGIN'])) { $login = "******"; header('Location: ./index.php'); } else { if ($_SESSION['LOGIN'] != true) { if (isset($_SESSION['UNAME'])) { unset($_SESSION['UNAME']); } if (isset($_SESSION['LOGIN'])) {
include $SSIfile; } ////////////////////////////////////////////////////////////// require $Root_Path . "bin/CR3DCQuery.php"; require $Root_Path . "bin/CTipOfTheDay.php"; require $Root_Path . "includes/siteconfig.php"; require $Root_Path . "includes/language.php"; $gid = trim($_GET['gameid']); $txtSearch = trim($_POST['txtSearch']); $cmdSearch = trim($_POST['cmdSearch']); $txtAbove = trim($_POST['txtAbove']); $txtBelow = trim($_POST['txtBelow']); $cmdSearchPoints = trim($_POST['cmdSearchPoints']); ////////////////////////////////////////////////////////////// //Instantiate the CR3DCQuery Class $oR3DCQuery = new CR3DCQuery($config); $bCronEnabled = $oR3DCQuery->IsCronManagementEnabled(); ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////// //Check if the logged in user has access if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) { $_SESSION['PageRef'] = $url; header('Location: ./chess_login.php'); } else { $oR3DCQuery->CheckSIDTimeout(); if ($oR3DCQuery->CheckLogin($config, $_SESSION['sid']) == false) { $_SESSION['PageRef'] = $url; header('Location: ./chess_login.php'); } else { $_SESSION['PageRef'] = ""; $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']);