diff --git a/css/style.css b/css/style.css index 05a9a61..1060280 100644 --- a/css/style.css +++ b/css/style.css @@ -174,6 +174,8 @@ ul li a { width: auto; margin-bottom: 0; margin-left: 7px; + background-color: white; + cursor: pointer; } .centerdiv { margin: auto; diff --git a/html/img/map/Viking_P.webp b/html/img/map/Fjordur.webp similarity index 100% rename from html/img/map/Viking_P.webp rename to html/img/map/Fjordur.webp diff --git a/html/nav.php b/html/nav.php index 0795d54..b45bdaf 100644 --- a/html/nav.php +++ b/html/nav.php @@ -3,12 +3,9 @@
  • Gameserver
  • '; - echo ''; + echo ''; echo ''; } else { echo '
    Login
    '; diff --git a/html/type/query.php b/html/type/query.php index af98c0b..296e77a 100644 --- a/html/type/query.php +++ b/html/type/query.php @@ -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];} @@ -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 { diff --git a/index.php b/index.php index 6faf482..1117653 100644 --- a/index.php +++ b/index.php @@ -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"; +} ?> #login-popup{display:flex};"; } if (isset($error['specialuser'])){echo $error['specialuser'];}elseif (isset($error['nomatch'])){echo $error['nomatch'];}else {echo "Register";} @@ -63,14 +82,6 @@ 0) { diff --git a/install.sh b/install.sh index 3562525..f660ba7 100644 --- a/install.sh +++ b/install.sh @@ -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 " html/config.php echo "\$DB_SERVER = 'localhost';" >> html/config.php diff --git a/notes.md b/notes.md index 2464ce9..b4db831 100644 --- a/notes.md +++ b/notes.md @@ -32,7 +32,7 @@ (@% - +http://array.include-once.org ## Liste Unterstützter Spiele:
    1. ARK Survival Evolved
    2. diff --git a/users/control/script.js b/users/control/script.js index 8cc9ac7..fb56cad 100644 --- a/users/control/script.js +++ b/users/control/script.js @@ -111,5 +111,64 @@ function changetheme(theme) { document.getElementById('vorschauparent').style.backgroundColor = servercolor; document.getElementById('vorschauparent').style.border = border; document.getElementById('themeinput').value = themename; - -} \ No newline at end of file +} +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"; +} diff --git a/users/control/server.php b/users/control/server.php index ea00b36..0624552 100644 --- a/users/control/server.php +++ b/users/control/server.php @@ -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) @@ -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 { @@ -272,7 +272,11 @@ function deleteserver($id, $arrayresult) { echo ""; exit; } - $serverjson[] = $addid; + if ($serverjson == [0]) { + $serverjson = [$addid]; + } else { + $serverjson[] = $addid; + } $serverjson = json_encode($serverjson); } } @@ -703,6 +707,7 @@ function getusernames() { }
      +

      Users

      @@ -715,6 +720,7 @@ function getusernames() { ?>
      +

      Users with permission, to control this server.

      @@ -726,11 +732,13 @@ function getusernames() {
      +
      " style="display:none">
      + diff --git a/users/control/settings.php b/users/control/settings.php index 52d8b1e..10f5d16 100644 --- a/users/control/settings.php +++ b/users/control/settings.php @@ -4,7 +4,7 @@ session_start(); if (!isset($_SESSION['username'])) { $_SESSION['msg'] = "You have to log in first"; - header('location: ../login.php'); + header('location: ../../?login=true'); exit; } $username = $_SESSION['username']; @@ -36,6 +36,35 @@ $usercount++; } } + +// Update profile picture +if (array_key_exists('chpp', $_POST)) { + $seed = $_POST["seed"]; + $sprite = $_POST["slctsprite"]; + if ($sprite == "human") { + $sprite = $_POST["selectsph"]; + } + $sql = "UPDATE users SET sprite='$sprite', seed='$seed' WHERE username='$username'"; + mysqli_query($conn, $sql); +} + +$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") { + $serverjson = json_decode($serverjson); + if ($serverjson[0] == 0) { + $servercount = 0; + } else { + $servercount = count($serverjson); + } +} function test_input($data) { $data = trim($data); @@ -66,6 +95,7 @@ function test_input($data) $displaysubmit = "none"; $displaytestconn = "block"; } + $dbscript = ""; } // Edit Database Configuration if (array_key_exists('submit', $_POST)) { @@ -79,6 +109,7 @@ function test_input($data) $configcontent = preg_replace('/\$DB_PASSWORD = \"(.*?)\";/', '$DB_PASSWORD = "'.$DB_PASSWORD.'";', $configcontent); $configcontent = preg_replace('/\$DB_NAME = \"(.*?)\";/', '$DB_NAME = "'.$DB_NAME.'";', $configcontent); file_put_contents($configfile, $configcontent); + $dbscript = ""; } // Choose a theme if (array_key_exists('submittheme', $_POST)) { @@ -124,7 +155,7 @@ function test_input($data) - +changetabacc('username')">