Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
AunePVP committed Dec 16, 2022
2 parents 341cb04 + 22e26e5 commit 4b4fad4
Show file tree
Hide file tree
Showing 15 changed files with 255 additions and 39 deletions.
2 changes: 2 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ ul li a {
width: auto;
margin-bottom: 0;
margin-left: 7px;
background-color: white;
cursor: pointer;
}
.centerdiv {
margin: auto;
Expand Down
File renamed without changes.
5 changes: 1 addition & 4 deletions html/nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
<li><a href="">Gameserver</a></li>
<div style="width: 100%;"></div>
<?php
session_start();
session_write_close();
if (isset($_SESSION['username'])) {
$username = $_SESSION['username'];
echo '<div class="dropdown" style="height: 58px;">';
echo '<a href="users/control/server.php"><img class="user-avater" src="https://avatars.akamai.steamstatic.com/ba20937c5bba10858664e3f32f7d2cc9e96a5275_full.jpg">';
echo '<a href="users/control/server.php"><img class="user-avater" src="https://avatars.dicebear.com/api/'.$sprite.'/'.$seed.'.svg">';
echo '</a><div class="dropdown-content"><a href="users/control/server.php">More</a><a href="users/logout.php">Logout</a></div></div>';
} else {
echo '<div class="login" style="cursor: pointer;"><a class="button white-hover" onclick="popuplogin()">Login</a><div class="dropdown-content"></div></div>';
Expand Down
4 changes: 2 additions & 2 deletions html/type/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
$clusterid = $serverstatus->rules->ClusterId_s ?? 'Not cluster';
// Check if server has a password
$password = $serverstatus->rules->ServerPassword_b ?? '';
if ($password == "True") {$password = $language[$lang][14];} else {$password = $language[$lang][15];}
if ($password == "True" || $password == "true") {$password = $language[$lang][14];} else {$password = $language[$lang][15];}
// Check if battleye is enabled
$battleye = $serverstatus->rules->SERVERUSESBATTLEYE_b ?? '';
if ($battleye) {$battleye=$language[$lang][14];}else {$battleye=$language[$lang][15];}
Expand All @@ -117,7 +117,7 @@
$mods[$value] = $modcontent;
}
}
$officialmaps = array("Aberration", "CrystalIsles", "Gen2", "Gen", "LostIsland", "Ragnarok", "ScorchedEarth", "TheCenter", "TheIsland", "Valguero", "Viking_P", "Valhalla", "TheVolcano");
$officialmaps = array("Aberration", "CrystalIsles", "Gen2", "Gen", "LostIsland", "Ragnarok", "ScorchedEarth", "TheCenter", "TheIsland", "Valguero", "Fjordur", "Valhalla", "TheVolcano");
if (in_array($map, $officialmaps)) {
$maplink = "html/img/map/$map.webp";
} else {
Expand Down
27 changes: 19 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
if (!isset($install)) {
header("Location: html/install.php");
}
session_start();
session_write_close();
$username = $_SESSION['username'] ?? "public";
$conn = mysqli_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_NAME);
$sql = "SELECT server, sprite, seed FROM users WHERE username='$username'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$serverjson = $row['server'];
$sprite = $row['sprite'];
$seed = $row['seed'];
}
}
if ($username == "admin") {
$seed = "d";
$sprite = "bottts";
}
?>
<!doctype html>
<html lang="<?php
Expand All @@ -29,6 +46,8 @@
session_start();
if (!empty($_SESSION['error'])) {
$error = $_SESSION['error'];
}
if (isset($_GET['login'])) {
echo "<style>#login-popup{display:flex};</style>";
}
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>";}
Expand Down Expand Up @@ -63,14 +82,6 @@
</tbody>
</table>
<?php
// DB Connection
$conn = mysqli_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_NAME);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if (!isset($username)) {
$username = "public";
}
$sql = "SELECT server FROM users WHERE username='$username'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if ! [ "$mysqlucheck" = 1 ]; then
fi
sudo mysql -e "GRANT ALL PRIVILEGES ON ${dbname}.* TO '${user}'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
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);"
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);"

echo "<?php" > html/config.php
echo "\$DB_SERVER = 'localhost';" >> html/config.php
Expand Down
2 changes: 1 addition & 1 deletion notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
(@%



http://array.include-once.org
## Liste Unterstützter Spiele:
<ol>
<li>ARK Survival Evolved</li>
Expand Down
63 changes: 61 additions & 2 deletions users/control/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,64 @@ function changetheme(theme) {
document.getElementById('vorschauparent').style.backgroundColor = servercolor;
document.getElementById('vorschauparent').style.border = border;
document.getElementById('themeinput').value = themename;

}
}
function changetabacc(value) {
document.querySelectorAll('.tabacc').forEach(function(el) {
el.style.display = 'none';
});
tablinksacc = document.getElementsByClassName("tablinksacc");
for (i = 0; i < tablinksacc.length; i++) {
tablinksacc[i].className = tablinksacc[i].className.replace(" active", "");
}
if (value === "username"){
document.getElementsByClassName('tabacc')[0].style.display = "block";
document.getElementsByClassName('tablinksacc')[0].classList.add("active");
} else if (value === "password") {
document.getElementsByClassName('tabacc')[1].style.display = "block";
document.getElementsByClassName('tablinksacc')[1].classList.add("active");
} else if (value === "delete") {
document.getElementsByClassName('tabacc')[2].style.display = "block";
document.getElementsByClassName('tablinksacc')[2].classList.add("active");
}
}
function newseed() {
let seed = document.getElementById("seed").value;
seedslice = seed.slice(0, 4);
seedchar = seed.slice(-1);
seedchar2 = seed.slice(-2);
if (!isNaN(seedchar)) {
let a = Number(seedchar);
let b = 1;
let nseedchar = a + b;
newseeds = seedslice + nseedchar;
} else {
newseeds = seedslice + "0";
}
document.getElementById("seed").value = newseeds;
selectstyle();
}
function selectstyle() {
let type = document.getElementById("style").value;
if (type === "adventurer") {
sprite = "adventurer";
} else if (type === "adventurer-neutral") {
sprite = "adventurer-neutral";
} else if (type === "human") {
document.getElementById("selectsph").style.display = "block";
sprite = document.getElementById("selectsph").value;
} else if (type === "bottts") {
sprite = "bottts";
} else if (type === "gridy") {
sprite = "gridy";
} else if (type === "identicon") {
sprite = "identicon";
} else if (type === "pixel-art") {
sprite = "pixel-art";
} else if (type === "pixel-art-neutral") {
sprite = "pixel-art-neutral";
}
if (type !== "human") {document.getElementById("selectsph").style.display = "none";}
let seed = document.getElementById("seed").value;
let link = "https://avatars.dicebear.com/api/";
document.getElementById("ppictureimg").src = link + sprite + "/" + seed + ".svg";
}
14 changes: 11 additions & 3 deletions users/control/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
session_start();
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You have to log in first";
header('location: ../login.php');
header('location: ../../?login=true');
exit;
}
function convertos($Os)
Expand Down Expand Up @@ -247,7 +247,7 @@ function deleteserver($id, $arrayresult) {
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$addid = $row['ID'];
$addid = $row["ID"];
$alreadyindb = TRUE;
}
} else {
Expand All @@ -272,7 +272,11 @@ function deleteserver($id, $arrayresult) {
echo "<script>alert('You alredy have access to this server!');window.location.reload();</script>";
exit;
}
$serverjson[] = $addid;
if ($serverjson == [0]) {
$serverjson = [$addid];
} else {
$serverjson[] = $addid;
}
$serverjson = json_encode($serverjson);
}
}
Expand Down Expand Up @@ -703,6 +707,7 @@ function getusernames() {
}
</script>
<div id="dragdropform">
<?php if($username=="admin"):?>
<div class="ddparent left">
<p>Users</p>
<div id="dragform" ondrop="drop(event, this)" ondragover="allowDrop(event)">
Expand All @@ -715,6 +720,7 @@ function getusernames() {
?>
</div>
</div>
<?php endif;?>
<div class="ddparent right">
<p>Users with permission, to control this server.</p>
<div id="dropform" ondrop="drop(event, this)" ondragover="allowDrop(event)">
Expand All @@ -726,11 +732,13 @@ function getusernames() {
</div>
</div>
</div>
<?php if($username=="admin"):?>
<button id="updatecontrolperm" onclick='getusernames()'>Update</button>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ."?id=$ServerID&page=settings"; ?>" style="display:none">
<input id="responsepermitted" name="responsepermitted">
<button id="updatepermission" type="submit" name="updatepermission"></button>
</form>
<?php endif;?>
<!-- Delete this server-->
<button type='button' id="deletebtn" onclick="confirmdelete()">Delete this server</button>
</div>
Expand Down
Loading

0 comments on commit 4b4fad4

Please sign in to comment.