-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgui_admin.php
More file actions
217 lines (191 loc) · 8.63 KB
/
gui_admin.php
File metadata and controls
217 lines (191 loc) · 8.63 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
date_default_timezone_set('Europe/Berlin');
session_start();
// https://www.php-einfach.de/php-tutorial/php-sessions/
require('./logger.php');
require('./db.php');
if (!isset($_SESSION['playerid'])) {
echo "Not logged in... redirecting.<br>";
echo "<meta http-equiv='refresh' content='0;url=./login.php?auto=1'>";
header("Location: ./login.php?auto=1");
//die("Check position 8");
}
// Get data on units from db
$pid = $_SESSION['playerid'];
$gid = $_SESSION['gameid'];
$pimage = $_SESSION['playerimage'];
$isAdmin = $_SESSION['isAdmin'];
$opt1 = isset($_GET["opt1"]) ? $_GET["opt1"] : "";
$opt2 = isset($_GET["opt2"]) ? $_GET["opt2"] : "";
$opt3 = isset($_GET["opt3"]) ? $_GET["opt3"] : "";
$opt4 = isset($_GET["opt4"]) ? $_GET["opt4"] : "";
$sql_asc_playerround = "SELECT SQL_NO_CACHE * FROM asc_player where playerid = " . $pid . ";";
$result_asc_playerround = mysqli_query($conn, $sql_asc_playerround);
if (mysqli_num_rows($result_asc_playerround) > 0) {
while($row = mysqli_fetch_assoc($result_asc_playerround)) {
$CURRENTROUND = $row["round"];
}
}
if ($opt1 == true || $opt2 == true || $opt3 == true || $opt4 == true) {
// storing changed options to database
$sql_update_options = "UPDATE asc_options SET OPTION1=".$opt1.", OPTION2=".$opt2.", OPTION3=".$opt3.", OPTION4=".$opt4." WHERE playerid = ".$pid;
$result_update_options = mysqli_query($conn, $sql_update_options);
$playMode = $opt3;
$distancesHexes = $opt4;
echo "<meta http-equiv='refresh' content='0;url=./gui_edit_option.php'>";
header("Location: ./gui_edit_option.php");
//die("Check position 7");
} else {
// getting options from database
$sql_asc_options = "SELECT SQL_NO_CACHE * FROM asc_options where playerid = ".$pid;
$result_asc_options = mysqli_query($conn, $sql_asc_options);
if (mysqli_num_rows($result_asc_options) > 0) {
while($row = mysqli_fetch_assoc($result_asc_options)) {
$opt1 = $row["option1"];
$opt2 = $row["option2"];
$opt3 = $row["option3"];
$opt4 = $row["option4"];
$_SESSION['option1'] = $opt1;
$_SESSION['option2'] = $opt2;
$_SESSION['option3'] = $opt3;
$_SESSION['option4'] = $opt4;
}
}
}
$playMode = $opt3;
$file_cacheversion = file_get_contents('./cache/mul/cache.version', true);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>ASCard.net AplhaStrike Card App (clanwolf.net): Administration</title>
<meta charset="utf-8">
<!-- <meta http-equiv="expires" content="0"> -->
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> -->
<meta name="description" content="Cards app for the AlphaStrike TableTop (BattleTech).">
<meta name="keywords" content="BattleTech, AlphaStrike">
<meta name="robots" content="noindex,nofollow">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="ASCard">
<meta name="viewport" content="width=device-width, initial-scale=0.75, minimum-scale=0.75, maximum-scale=1.85, user-scalable=yes" />
<link rel="manifest" href="/app/ascard.webmanifest">
<link rel="stylesheet" type="text/css" href="./fontawesome/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./styles/styles.css">
<link rel="icon" type="image/png" href="/app/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="/app/favicon.svg" />
<link rel="shortcut icon" href="/app/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/app/apple-touch-icon.png" />
<!-- https://www.npmjs.com/package/passive-events-support?activeTab=readme -->
<script>
window.passiveSupport = {
debug: false,
events: ['touchstart', 'touchmove', 'wheel'],
listeners: [
{
element: '.jspContainer',
event: 'touchstart',
prevented: true
},
{
element: '.jspContainer',
event: 'touchmove',
prevented: true
},
{
element: '.jspContainer',
event: 'wheel',
prevented: true
}
]
}
</script>
<script type="text/javascript" src="./scripts/passive-events-support/main.js"></script>
<script type="text/javascript" src="./scripts/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="./scripts/howler.min.js"></script>
<script type="text/javascript" src="./scripts/cookies.js"></script>
<style>
html, body {
background-image: url('./images/body-bg_2.jpg');
}
table {
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<script>
$(document).ready(function() {
$("#cover").hide();
});
</script>
<div id="cover"></div>
<?php
if ($playMode) {
$buttonWidth = "33.3%"; // 3 columns in the middle
} else {
if ($isAdmin) {
$buttonWidth = "17%"; // 6 columns
} else {
$buttonWidth = "25%"; // 4 columns
}
}
?>
<div id="header">
<table style="width:100%;height:60px;border:none;border-collapse:collapse;background:rgba(50,50,50,1.0);" cellspacing="0" cellpadding="0">
<tr>
<td nowrap onclick="location.href='./logout.php'" style="width: 80px;background: rgba(50,50,50,1.0); text-align: center; vertical-align: middle;">
<div><a style="color: #eee;" href="./logout.php"> <i class="fas fa-power-off" aria-hidden="true"></i> </a></div>
</td>
<td nowrap onclick="location.href='./gui_edit_game.php'" style="width: 100px;background:rgba(56,87,26,1.0);">
<div style='vertical-align:middle;font-size:28px;color:#eee;'> G<?php echo $gid ?> R<?php echo $CURRENTROUND ?> </div>
</td>
<td style="width:5px;"> </td>
<td nowrap onclick="location.href='./gui_select_unit.php'" width="<?php echo $buttonWidth ?>" class='menu_button_normal'><a href='./gui_select_unit.php'><i class="fa-solid fa-list"></i> ROSTER</a></td>
<td style="width:5px;"> </td>
<?php
if ($playMode) {
echo " <td nowrap onclick=\"location.href='./gui_select_formation.php'\" width=".$buttonWidth." class='menu_button_normal'><a href='./gui_select_formation.php'>CHALLENGE</a></td><td style='width:5px;'> </td>\n";
}
if (!$playMode) {
echo " <td nowrap onclick=\"location.href='./gui_assign_unit.php'\" width=".$buttonWidth." class='menu_button_normal'><a href='./gui_assign_unit.php'>ASSIGN</a></td><td style='width:5px;'> </td>\n";
echo " <td nowrap onclick=\"location.href='./gui_create_unit.php'\" width=".$buttonWidth." class='menu_button_normal'><a href='./gui_create_unit.php'>CREATE</a></td><td style='width:5px;'> </td>\n";
//echo " <td nowrap onclick=\"location.href='./gui_edit_game.php'\" width=".$buttonWidth." class='menu_button_normal'><a href='./gui_edit_game.php'>GAME</a></td><td style='width:5px;'> </td>\n";
if ($isAdmin) {
echo " <td nowrap onclick=\"location.href='./gui_create_player.php'\" width=".$buttonWidth." class='menu_button_normal'><a href='./gui_create_player.php'>PLAYER</a></td><td style='width:5px;'> </td>\n";
echo " <td nowrap onclick=\"location.href='./gui_admin.php'\" width=".$buttonWidth." class='menu_button_active'><a href='./gui_admin.php'>ADMIN</a></td><td style='width:5px;'> </td>\n";
}
}
?>
<td nowrap onclick="location.href='./gui_edit_option.php'" width="<?php echo $buttonWidth ?>" class='menu_button_normal'><a href='./gui_edit_option.php'>OPTIONS</a></td>
<td style="width:5px;"> </td>
<td nowrap onclick="location.href='gui_show_playerlist.php'" style="width: 60px;" nowrap width="60px" style="background: rgba(50,50,50,1.0); text-align: center; vertical-align: middle;"><img src='./images/player/<?=$pimage?>' style='height:auto;display:block;' width='60px' height='60px'></td>
</tr>
<tr><td colspan='999' style='background:rgba(50,50,50,1.0);height:5px;'></td></tr>
</table>
</div>
<div id="liberapay"><a href="./gui_show_support.php"><i class="fa-solid fa-handshake-simple"></i></a></div>
<div id="disclaimer"><a href="./gui_show_disclaimer.php">Disclaimer</a></div>
<br>
<div>
<table class="options" cellspacing=4 cellpadding=4 border=0px>
<?php
if ($isAdmin) {
// echo "<tr><td colspan='2'><hr></td></tr>\n";
echo "<tr>\n";
echo " <td align='left' class='datalabel'>Update unit cache from MUL</td>\n";
echo " <td onclick='window.open(\"https://www.ascard.net/app/data/mul_cache/cache.php\");'>\n";
echo " <i class='fa-solid fa-cloud-arrow-down'></i>\n";
echo " </td>\n";
echo "</tr>\n";
}
?>
</table>
</div>
<p align="center" class="footerInfo">(MUL cache updated: <?php echo $file_cacheversion ?>)</p>
</body>
</html>