function joinGame($id, $user, $deck) { $players = getGamePlayers($id); if ($players[0] == 0) { $sql = "UPDATE field SET PlayerBlue = '{$user}', DeckBlue = '{$deck}', Turn = '1', Status = '1' WHERE FieldID = '{$id}'"; } else { $sql = "UPDATE field SET PlayerRed = '{$user}', DeckRed = '{$deck}', Turn = '1', Status = '1' WHERE FieldID = '{$id}'"; } mysql_query($sql); drawStartingHand($id); }
$gamestatus = getGameStatus($id); $bluewin = ""; $redwin = ""; if ($gamestatus == 2) { $bluewin = "lost."; $redwin = "WON!"; } if ($gamestatus == 3) { $bluewin = "WON!"; $redwin = "lost."; } if ($gamestatus == 5) { $bluewin = "draw.~"; $redwin = "draw.~"; } $players = getGamePlayers($id); $players[0] = parseUserID($players[0]); $players[1] = parseUserID($players[1]); /********************************************************************************************************************** * Show Blue Hand **********************************************************************************************************************/ $reloader = "<br /><br /><a href='game.php?id=" . $id . "'> <img src='image/reload.png' /></a>"; echo '<div id="blue">'; echo "<h2>" . $players[0] . " " . $bluewin . "</h2>"; $blueHand = new hand(getBlueHand($id), false); if (!$blueplayer) { $blueHand->showHand(); } else { $hand = $blueHand; $blueHand->showYourHand($id); echo $reloader;