/* Start game page. */ include 'verifysession.php'; include 'io.php'; include 'render.php'; /* If color and opponent is submitted create new game and redirect to board page. */ if (isset($_POST['color']) && isset($_POST['opponent'])) { if ($_POST['color']=='w') { $white=$uid; $black=$_POST['opponent']; $comment=null; } else { $white=$_POST['opponent']; $black=$uid; $comment=$_POST['comment']; } $gid=ioCreateGame($white,$black,$comment); /* send notification about new game, if player is black, for white * player first move will be sent as notification */ if ($_POST['color']=='b') { $email=ioLoadUserEmailAddress($white); if ($email) { $message="Dear $white,\n\n". "$black has started a game.\n\n". "Comment:\n$comment\n\n". "It is your turn now!\n\n". "Enter the game:\n".getGameURL($gid); mail($email,"[OCC] New Game: $white vs $black", $message, $mail_header); } } header('location:board.php?gid='.$gid); } /* JS confirm dialog */ echo ''; renderPageBegin('OCC - New Game',null,array( 'My Games'=>'index.php', 'Help'=>'help.php', 'Logout'=>'logout.php'), 'New Game'); ?>
renderPageEnd(null); ?>