Skip to content

Commit 4b4fad4

Browse files
committed
Merge branch 'development'
2 parents 341cb04 + 22e26e5 commit 4b4fad4

File tree

15 files changed

+255
-39
lines changed

15 files changed

+255
-39
lines changed

css/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ ul li a {
174174
width: auto;
175175
margin-bottom: 0;
176176
margin-left: 7px;
177+
background-color: white;
178+
cursor: pointer;
177179
}
178180
.centerdiv {
179181
margin: auto;
File renamed without changes.

html/nav.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
<li><a href="">Gameserver</a></li>
44
<div style="width: 100%;"></div>
55
<?php
6-
session_start();
7-
session_write_close();
86
if (isset($_SESSION['username'])) {
9-
$username = $_SESSION['username'];
107
echo '<div class="dropdown" style="height: 58px;">';
11-
echo '<a href="users/control/server.php"><img class="user-avater" src="https://avatars.akamai.steamstatic.com/ba20937c5bba10858664e3f32f7d2cc9e96a5275_full.jpg">';
8+
echo '<a href="users/control/server.php"><img class="user-avater" src="https://avatars.dicebear.com/api/'.$sprite.'/'.$seed.'.svg">';
129
echo '</a><div class="dropdown-content"><a href="users/control/server.php">More</a><a href="users/logout.php">Logout</a></div></div>';
1310
} else {
1411
echo '<div class="login" style="cursor: pointer;"><a class="button white-hover" onclick="popuplogin()">Login</a><div class="dropdown-content"></div></div>';

html/type/query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
$clusterid = $serverstatus->rules->ClusterId_s ?? 'Not cluster';
9494
// Check if server has a password
9595
$password = $serverstatus->rules->ServerPassword_b ?? '';
96-
if ($password == "True") {$password = $language[$lang][14];} else {$password = $language[$lang][15];}
96+
if ($password == "True" || $password == "true") {$password = $language[$lang][14];} else {$password = $language[$lang][15];}
9797
// Check if battleye is enabled
9898
$battleye = $serverstatus->rules->SERVERUSESBATTLEYE_b ?? '';
9999
if ($battleye) {$battleye=$language[$lang][14];}else {$battleye=$language[$lang][15];}
@@ -117,7 +117,7 @@
117117
$mods[$value] = $modcontent;
118118
}
119119
}
120-
$officialmaps = array("Aberration", "CrystalIsles", "Gen2", "Gen", "LostIsland", "Ragnarok", "ScorchedEarth", "TheCenter", "TheIsland", "Valguero", "Viking_P", "Valhalla", "TheVolcano");
120+
$officialmaps = array("Aberration", "CrystalIsles", "Gen2", "Gen", "LostIsland", "Ragnarok", "ScorchedEarth", "TheCenter", "TheIsland", "Valguero", "Fjordur", "Valhalla", "TheVolcano");
121121
if (in_array($map, $officialmaps)) {
122122
$maplink = "html/img/map/$map.webp";
123123
} else {

index.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
if (!isset($install)) {
99
header("Location: html/install.php");
1010
}
11+
session_start();
12+
session_write_close();
13+
$username = $_SESSION['username'] ?? "public";
14+
$conn = mysqli_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_NAME);
15+
$sql = "SELECT server, sprite, seed FROM users WHERE username='$username'";
16+
$result = mysqli_query($conn, $sql);
17+
if (mysqli_num_rows($result) > 0) {
18+
while ($row = mysqli_fetch_assoc($result)) {
19+
$serverjson = $row['server'];
20+
$sprite = $row['sprite'];
21+
$seed = $row['seed'];
22+
}
23+
}
24+
if ($username == "admin") {
25+
$seed = "d";
26+
$sprite = "bottts";
27+
}
1128
?>
1229
<!doctype html>
1330
<html lang="<?php
@@ -29,6 +46,8 @@
2946
session_start();
3047
if (!empty($_SESSION['error'])) {
3148
$error = $_SESSION['error'];
49+
}
50+
if (isset($_GET['login'])) {
3251
echo "<style>#login-popup{display:flex};</style>";
3352
}
3453
if (isset($error['specialuser'])){echo $error['specialuser'];}elseif (isset($error['nomatch'])){echo $error['nomatch'];}else {echo "<a class='button white-hover' href='users/register.php'>Register</a>";}
@@ -63,14 +82,6 @@
6382
</tbody>
6483
</table>
6584
<?php
66-
// DB Connection
67-
$conn = mysqli_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_NAME);
68-
if (!$conn) {
69-
die("Connection failed: " . mysqli_connect_error());
70-
}
71-
if (!isset($username)) {
72-
$username = "public";
73-
}
7485
$sql = "SELECT server FROM users WHERE username='$username'";
7586
$result = mysqli_query($conn, $sql);
7687
if (mysqli_num_rows($result) > 0) {

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if ! [ "$mysqlucheck" = 1 ]; then
4848
fi
4949
sudo mysql -e "GRANT ALL PRIVILEGES ON ${dbname}.* TO '${user}'@'localhost';"
5050
sudo mysql -e "FLUSH PRIVILEGES;"
51-
sudo mysql -e "USE ${dbname}; CREATE TABLE users (id INT auto_increment PRIMARY KEY AUTO_INCREMENT, username VARCHAR(100) NOT NULL, password VARCHAR(100) NOT NULL, server JSON NOT NULL);"
51+
sudo mysql -e "USE ${dbname}; CREATE TABLE users (id INT auto_increment PRIMARY KEY AUTO_INCREMENT, username VARCHAR(100) NOT NULL, password VARCHAR(100) NOT NULL, server JSON NOT NULL, sprite VARCHAR(25) NOT NULL, seed VARCHAR(100) NOT NULL);"
5252

5353
echo "<?php" > html/config.php
5454
echo "\$DB_SERVER = 'localhost';" >> html/config.php

notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
(@%
3333

3434

35-
35+
http://array.include-once.org
3636
## Liste Unterstützter Spiele:
3737
<ol>
3838
<li>ARK Survival Evolved</li>

users/control/script.js

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,64 @@ function changetheme(theme) {
111111
document.getElementById('vorschauparent').style.backgroundColor = servercolor;
112112
document.getElementById('vorschauparent').style.border = border;
113113
document.getElementById('themeinput').value = themename;
114-
115-
}
114+
}
115+
function changetabacc(value) {
116+
document.querySelectorAll('.tabacc').forEach(function(el) {
117+
el.style.display = 'none';
118+
});
119+
tablinksacc = document.getElementsByClassName("tablinksacc");
120+
for (i = 0; i < tablinksacc.length; i++) {
121+
tablinksacc[i].className = tablinksacc[i].className.replace(" active", "");
122+
}
123+
if (value === "username"){
124+
document.getElementsByClassName('tabacc')[0].style.display = "block";
125+
document.getElementsByClassName('tablinksacc')[0].classList.add("active");
126+
} else if (value === "password") {
127+
document.getElementsByClassName('tabacc')[1].style.display = "block";
128+
document.getElementsByClassName('tablinksacc')[1].classList.add("active");
129+
} else if (value === "delete") {
130+
document.getElementsByClassName('tabacc')[2].style.display = "block";
131+
document.getElementsByClassName('tablinksacc')[2].classList.add("active");
132+
}
133+
}
134+
function newseed() {
135+
let seed = document.getElementById("seed").value;
136+
seedslice = seed.slice(0, 4);
137+
seedchar = seed.slice(-1);
138+
seedchar2 = seed.slice(-2);
139+
if (!isNaN(seedchar)) {
140+
let a = Number(seedchar);
141+
let b = 1;
142+
let nseedchar = a + b;
143+
newseeds = seedslice + nseedchar;
144+
} else {
145+
newseeds = seedslice + "0";
146+
}
147+
document.getElementById("seed").value = newseeds;
148+
selectstyle();
149+
}
150+
function selectstyle() {
151+
let type = document.getElementById("style").value;
152+
if (type === "adventurer") {
153+
sprite = "adventurer";
154+
} else if (type === "adventurer-neutral") {
155+
sprite = "adventurer-neutral";
156+
} else if (type === "human") {
157+
document.getElementById("selectsph").style.display = "block";
158+
sprite = document.getElementById("selectsph").value;
159+
} else if (type === "bottts") {
160+
sprite = "bottts";
161+
} else if (type === "gridy") {
162+
sprite = "gridy";
163+
} else if (type === "identicon") {
164+
sprite = "identicon";
165+
} else if (type === "pixel-art") {
166+
sprite = "pixel-art";
167+
} else if (type === "pixel-art-neutral") {
168+
sprite = "pixel-art-neutral";
169+
}
170+
if (type !== "human") {document.getElementById("selectsph").style.display = "none";}
171+
let seed = document.getElementById("seed").value;
172+
let link = "https://avatars.dicebear.com/api/";
173+
document.getElementById("ppictureimg").src = link + sprite + "/" + seed + ".svg";
174+
}

users/control/server.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
session_start();
2525
if (!isset($_SESSION['username'])) {
2626
$_SESSION['msg'] = "You have to log in first";
27-
header('location: ../login.php');
27+
header('location: ../../?login=true');
2828
exit;
2929
}
3030
function convertos($Os)
@@ -247,7 +247,7 @@ function deleteserver($id, $arrayresult) {
247247
$result = mysqli_query($conn, $sql);
248248
if (mysqli_num_rows($result) > 0) {
249249
while ($row = mysqli_fetch_assoc($result)) {
250-
$addid = $row['ID'];
250+
$addid = $row["ID"];
251251
$alreadyindb = TRUE;
252252
}
253253
} else {
@@ -272,7 +272,11 @@ function deleteserver($id, $arrayresult) {
272272
echo "<script>alert('You alredy have access to this server!');window.location.reload();</script>";
273273
exit;
274274
}
275-
$serverjson[] = $addid;
275+
if ($serverjson == [0]) {
276+
$serverjson = [$addid];
277+
} else {
278+
$serverjson[] = $addid;
279+
}
276280
$serverjson = json_encode($serverjson);
277281
}
278282
}
@@ -703,6 +707,7 @@ function getusernames() {
703707
}
704708
</script>
705709
<div id="dragdropform">
710+
<?php if($username=="admin"):?>
706711
<div class="ddparent left">
707712
<p>Users</p>
708713
<div id="dragform" ondrop="drop(event, this)" ondragover="allowDrop(event)">
@@ -715,6 +720,7 @@ function getusernames() {
715720
?>
716721
</div>
717722
</div>
723+
<?php endif;?>
718724
<div class="ddparent right">
719725
<p>Users with permission, to control this server.</p>
720726
<div id="dropform" ondrop="drop(event, this)" ondragover="allowDrop(event)">
@@ -726,11 +732,13 @@ function getusernames() {
726732
</div>
727733
</div>
728734
</div>
735+
<?php if($username=="admin"):?>
729736
<button id="updatecontrolperm" onclick='getusernames()'>Update</button>
730737
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ."?id=$ServerID&page=settings"; ?>" style="display:none">
731738
<input id="responsepermitted" name="responsepermitted">
732739
<button id="updatepermission" type="submit" name="updatepermission"></button>
733740
</form>
741+
<?php endif;?>
734742
<!-- Delete this server-->
735743
<button type='button' id="deletebtn" onclick="confirmdelete()">Delete this server</button>
736744
</div>

0 commit comments

Comments
 (0)