forked from SWU-Petranaki/SWUOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJoinGame.php
More file actions
102 lines (91 loc) · 3.49 KB
/
JoinGame.php
File metadata and controls
102 lines (91 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
include_once 'MenuBar.php';
include "HostFiles/Redirector.php";
include_once "Libraries/PlayerSettings.php";
include_once 'Assets/patreon-php-master/src/PatreonDictionary.php';
include_once './AccountFiles/AccountDatabaseAPI.php';
// Check if the user is banned
if (isset($_SESSION["userid"]) && IsBanned($_SESSION["userid"])) {
header("Location: ./PlayerBanned.php");
exit;
}
$gameName = $_GET["gameName"];
if (!IsGameNameValid($gameName)) {
echo ("Invalid game name.");
exit;
}
$playerID = $_GET["playerID"];
if ($playerID == "1") {
echo ("Player 1 should not use JoinGame.php");
exit;
}
$settingArray = [];
if (isset($_SESSION["userid"])) {
$savedSettings = LoadSavedSettings($_SESSION["userid"]);
for ($i = 0; $i < count($savedSettings); $i += 2) {
$settingArray[$savedSettings[intval($i)]] = $savedSettings[intval($i) + 1];
}
}
?>
<?php
include_once 'Header.php';
?>
<div class="core-wrapper">
<div class="flex-padder"></div>
<div class="flex-wrapper">
<div class='game-invite container bg-yellow'>
<h2>Join Game</h2>
<?php
echo ("<form action='" . $redirectPath . "/JoinGameInput.php'>");
echo ("<input type='hidden' id='gameName' name='gameName' value='$gameName'>");
echo ("<input type='hidden' id='playerID' name='playerID' value='$playerID'>");
?>
<?php
echo ("<form style='display:inline-block;' action='" . $redirectPath . "/CreateGame.php'>");
$favoriteDecks = [];
if (isset($_SESSION["userid"])) {
$favoriteDecks = LoadFavoriteDecks($_SESSION["userid"]);
if (count($favoriteDecks) > 0) {
$selIndex = -1;
if (isset($settingArray[$SET_FavoriteDeckIndex])) $selIndex = $settingArray[$SET_FavoriteDeckIndex];
echo ("<label for='favoriteDecks'>Favorite Decks");
echo ("<select name='favoriteDecks' id='favoriteDecks'>");
for ($i = 0; $i < count($favoriteDecks); $i += 4) {
echo ("<option value='" . $favoriteDecks[$i] . "'" . ($i == $selIndex ? " selected " : "") . ">" . $favoriteDecks[$i + 1] . "</option>");
}
echo ("</select></label>");
}
}
/*
if (count($favoriteDecks) == 0) {
echo ("<div><label class='SelectDeckInput'>Starter Decks: </label>");
echo ("<select name='decksToTry' id='decksToTry'>");
echo ("</select></div>");
}
*/
?>
<label for="fabdb"><u><a style='color:darksalmon;' href='https://www.swudb.com/' target='_blank'>SWUDB</a></u> or <u><a style='color:darksalmon;' href='https://www.sw-unlimited-db.com/' target='_blank'>SW-Unlimited-DB</a></u> Deck Link <span class="secondary">(use the url or 'Deck Link' button)</span></label>
<input type="text" id="fabdb" name="fabdb">
<?php
if (isset($_SESSION["userid"])) {
echo ("<span class='save-deck'>");
echo ("<label for='favoriteDeck'><input title='Save deck to Favorites' class='inputFavoriteDeck' type='checkbox' id='favoriteDeck' name='favoriteDeck' />");
echo ("Save Deck to Favorites</label>");
echo ("</span>");
}
?>
<div style='text-align:center;'><input class="JoinGame_Button" type="submit" value="Join Game"></div>
</form>
</div>
<div class="container bg-yellow">
<h3>Instructions</h3>
<p>Choose a deck, then click 'Join Game' to be taken to the game lobby.</p>
<p>Once in the game lobby, the player who win the dice roll choose if the go first. Then the host can start the game.</p>
<p>Have Fun!</p>
</div>
</div>
<div class="flex-padder"></div>
</div>
<?php
include_once 'Disclaimer.php'
?>