query($query); // reload so we don't double post header('Location: play.php'); exit; } // save the chat box status if it's changed if (isset($_POST['private'])){ $private = (int) $_POST['private']; $query = " UPDATE ".T_GAME." SET g_private_chat_box = '{$private}' WHERE g_id = '{$_SESSION['game_id']}' "; $mysql->query($query); // reload so we don't double post header('Location: play.php'); exit; } $board = create_empty_board($game['board_size']); list($board, $oldboard, $passes, $resign, $bprisoners, $wprisoners, $mstonex, $mstoney, $history, $number_of_moves) = play_moves($game['moves'], $board, $game['board_size'], $game['handicap']); // are we passing or resigning ? if (isset($_GET['submit']) && ('' != $_GET['submit']) && $game['player']['move']) { $color = strtolower(substr($game['player']['color'], 0, 1)); if ('pass' == $_GET['submit']) { save_game($_SESSION['game_id'], $color . 'xx', $passes); header('Location: play.php'); exit; } else if ('resign' == $_GET['submit']) { save_game($_SESSION['game_id'], $color . 'zz', 0); header('Location: play.php'); exit; } } // are we making a move ? if (isset($_POST['x']) && ('' != $_POST['x'])) { $removed = ''; $color = strtolower(substr($game['player']['color'], 0, 1)); $x = (int) substr($_POST['x'], 0 ,2); $y = (int) substr($_POST['y'], 0 ,2); if (is_legal_move($y, $x, $color) && ! is_ko($y, $x, $color)) { do_move($y, $x, $color); $mstonex = $x; $mstoney = $y; if ($color == 'b') { $cprint = 'Black'; if (strlen(trim($removed)) > 0) { $bprisoners += strlen(trim($removed)) / 3; } } if ($color == 'w') { $cprint = 'White'; if (strlen(trim($removed)) > 0) { $wprisoners += strlen(trim($removed)) / 3; } } array_push($history, strtolower(xtoalt($x)) . ($game['board_size'] - $y)); ++$number_of_moves; $removed = save_game($_SESSION['game_id'], $color . chr($y + 97) . chr($x + 97), $passes, $removed); do_mail($_SESSION['game_id'], $game['opponent']['email'], $game['player']['username'], 'yourturn'); // reload so we don't double post header('Location: play.php'); exit; } else { $error = 'That move was not a legal move'; } } // relaod the game to get the new data load_game($_SESSION['game_id']); $game = $_SESSION['gamedata']; // get the chat box data $query = " SELECT * , p_username FROM ".T_CHAT." LEFT JOIN ".T_PLAYER." ON p_id = c_player_id WHERE c_game_id = '{$_SESSION['game_id']}' AND ( ( c_player_id = '{$_SESSION['player_id']}' AND c_private = 'Yes' ) OR ( c_private = 'No' ) ) ORDER BY c_postdate DESC "; $chat_data = $mysql->fetch_array($query, __LINE__, __FILE__); // start the page echo "\n"; ?> iShudan : Play

iShudan :: play