From f8b45ec257dc7cc374a295f13307a9cb950bcef0 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 2 Nov 2023 22:39:01 +0000 Subject: [PATCH] PUSH -> Added egg config values --- api/admin/redeem/create.php | 2 +- api/admin/redeem/delete.php | 4 +- api/admin/redeem/info.php | 4 +- api/admin/settings/get.php | 2 +- api/admin/statistics.php | 2 +- api/admin/user/ban.php | 4 +- api/admin/user/info.php | 4 +- api/admin/user/list.php | 4 +- api/admin/user/reset-password.php | 4 +- api/admin/user/resources/add.php | 4 +- api/admin/user/resources/set.php | 4 +- api/admin/user/unban.php | 4 +- app/EggManagerConfig.php | 54 ++++++++++ app/SettingsManager.php | 17 ++++ crons/server.php | 139 ++++++++------------------ migrate/38.sql | 1 + migrate/39.sql | 73 ++++++++++++++ routes/admin/eggs.php | 17 +++- view/admin/api/main.php | 15 +-- view/admin/eggs/create.php | 8 +- view/admin/eggs/delete.php | 10 +- view/admin/eggs/main.php | 90 ++++++++--------- view/admin/eggs/manager_create.php | 35 +++++++ view/admin/eggs/manager_delete.php | 30 ++++++ view/admin/eggs/manager_list.php | 154 +++++++++++++++++++++++++++++ view/admin/locations/delete.php | 2 +- view/admin/locations/main.php | 80 +++++++-------- view/admin/redeem/delete.php | 4 +- view/admin/redeem/main.php | 35 +++---- view/components/sidebar.php | 24 +++-- view/earn/redeem.php | 2 +- view/install/servercheck.php | 4 +- view/tickets/chat.php | 4 +- view/tickets/reopen.php | 4 +- view/tickets/reply.php | 4 +- view/user/gift.php | 4 +- view/user/profile.php | 6 +- 37 files changed, 581 insertions(+), 277 deletions(-) create mode 100644 app/EggManagerConfig.php create mode 100644 migrate/38.sql create mode 100644 migrate/39.sql create mode 100644 view/admin/eggs/manager_create.php create mode 100644 view/admin/eggs/manager_delete.php create mode 100644 view/admin/eggs/manager_list.php diff --git a/api/admin/redeem/create.php b/api/admin/redeem/create.php index 808ec9d6..f3fdb3ee 100644 --- a/api/admin/redeem/create.php +++ b/api/admin/redeem/create.php @@ -151,7 +151,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/redeem/delete.php b/api/admin/redeem/delete.php index 236dc77d..a2ac3693 100644 --- a/api/admin/redeem/delete.php +++ b/api/admin/redeem/delete.php @@ -22,7 +22,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find the code in our database!" + "message" => "We cannot find the code in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -41,7 +41,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/redeem/info.php b/api/admin/redeem/info.php index be14c54d..573664b3 100644 --- a/api/admin/redeem/info.php +++ b/api/admin/redeem/info.php @@ -39,7 +39,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find the code in our database!" + "message" => "We cannot find the code in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -58,7 +58,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/settings/get.php b/api/admin/settings/get.php index 255ea739..8f7e53e4 100644 --- a/api/admin/settings/get.php +++ b/api/admin/settings/get.php @@ -53,7 +53,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/statistics.php b/api/admin/statistics.php index 517f4b12..4e8b7a50 100644 --- a/api/admin/statistics.php +++ b/api/admin/statistics.php @@ -45,7 +45,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); ErrorHandler::Critical("Statistics ",$e); diff --git a/api/admin/user/ban.php b/api/admin/user/ban.php index ba318d28..f2d06241 100644 --- a/api/admin/user/ban.php +++ b/api/admin/user/ban.php @@ -37,7 +37,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find this user in our database!" + "message" => "We cannot find this user in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -57,7 +57,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/user/info.php b/api/admin/user/info.php index 6a75da66..905dbba7 100644 --- a/api/admin/user/info.php +++ b/api/admin/user/info.php @@ -60,7 +60,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find this user in our database!" + "message" => "We cannot find this user in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -80,7 +80,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/user/list.php b/api/admin/user/list.php index 6607ce0d..d42ca48b 100644 --- a/api/admin/user/list.php +++ b/api/admin/user/list.php @@ -55,7 +55,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -65,7 +65,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/user/reset-password.php b/api/admin/user/reset-password.php index 179cca7a..a0458c6e 100644 --- a/api/admin/user/reset-password.php +++ b/api/admin/user/reset-password.php @@ -27,7 +27,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find this user in our database!" + "message" => "We cannot find this user in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -47,7 +47,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/user/resources/add.php b/api/admin/user/resources/add.php index 650cd950..73064f35 100644 --- a/api/admin/user/resources/add.php +++ b/api/admin/user/resources/add.php @@ -133,7 +133,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find this user in our database!" + "message" => "We cannot find this user in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -153,7 +153,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/user/resources/set.php b/api/admin/user/resources/set.php index b59fca6e..0f45b8bc 100644 --- a/api/admin/user/resources/set.php +++ b/api/admin/user/resources/set.php @@ -117,7 +117,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find this user in our database!" + "message" => "We cannot find this user in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -137,7 +137,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/api/admin/user/unban.php b/api/admin/user/unban.php index 0f39baca..0422d452 100644 --- a/api/admin/user/unban.php +++ b/api/admin/user/unban.php @@ -31,7 +31,7 @@ $rsp = array( "code" => 403, "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find this user in our database!" + "message" => "We cannot find this user in our database!" ); http_response_code(403); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); @@ -51,7 +51,7 @@ $rsp = array( "code" => 500, "error" => "The server encountered a situation it doesn't know how to handle.", - "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + "message" => "We are sorry, but our server cannot handle this request. Please do not try again!" ); http_response_code(500); die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); diff --git a/app/EggManagerConfig.php b/app/EggManagerConfig.php new file mode 100644 index 00000000..9d5f1e41 --- /dev/null +++ b/app/EggManagerConfig.php @@ -0,0 +1,54 @@ +connectToDatabase(); + $sql = "SELECT setting_value FROM mythicaldash_eggs_config WHERE setting_name = ?"; + $stmt = $conn->prepare($sql); + $stmt->bind_param("s", $settingName); + $stmt->execute(); + $result = $stmt->get_result(); + if ($row = $result->fetch_assoc()) { + return $row["setting_value"]; + } + return null; + } + + public static function updateConfig($settingName, $settingValue) + { + $connect = new Connect(); + $conn = $connect->connectToDatabase(); + $sql = "INSERT INTO mythicaldash_eggs_config (setting_name, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)"; + $stmt = $conn->prepare($sql); + $stmt->bind_param("ss", $settingName, $settingValue); + return $stmt->execute(); + } + + public static function deleteConfig($settingName) + { + $connect = new Connect(); + $conn = $connect->connectToDatabase(); + $sql = "DELETE FROM mythicaldash_eggs_config WHERE setting_name = ?"; + $stmt = $conn->prepare($sql); + $stmt->bind_param("s", $settingName); + return $stmt->execute(); + } + + public static function addConfig($settingName, $settingValue) + { + $connect = new Connect(); + $conn = $connect->connectToDatabase(); + $sql = "INSERT INTO mythicaldash_eggs_config (setting_name, setting_value) VALUES (?, ?)"; + $stmt = $conn->prepare($sql); + $stmt->bind_param("ss", $settingName, $settingValue); + return $stmt->execute(); + } +} +?> \ No newline at end of file diff --git a/app/SettingsManager.php b/app/SettingsManager.php index 11cf29cf..67f827c2 100644 --- a/app/SettingsManager.php +++ b/app/SettingsManager.php @@ -22,4 +22,21 @@ public static function getSetting($settingName) { return null; } } + public static function updateSetting($settingName, $settingValue) { + $connect = new Connect(); + $conn = $connect->connectToDatabase(); + $safeSettingName = $conn->real_escape_string($settingName); + $safeSettingValue = $conn->real_escape_string($settingValue); + + $query = "UPDATE mythicaldash_settings SET `$safeSettingName` = '$safeSettingValue'"; + + if ($conn->query($query)) { + $conn->close(); + return true; + } else { + $conn->close(); + return false; + } + } + } \ No newline at end of file diff --git a/crons/server.php b/crons/server.php index 244d4d1e..9531d6f7 100644 --- a/crons/server.php +++ b/crons/server.php @@ -1,18 +1,18 @@ connect_error) { - echo "[WARNING] We can't connect to the MySQL server."; + echo "[WARNING] We cannot connect to the MySQL server."; } $timeAtStart = time(); $i = 0; @@ -34,9 +34,9 @@ $queue = mysqli_query($conn, "SELECT * FROM mythicaldash_servers_queue ORDER BY type DESC"); echo "[INFO/loader] " . $queue->num_rows . " servers in queue!\n"; echo "\033[32m[INFO/loader] Processing started!\n"; -foreach($queue as $server) { +foreach ($queue as $server) { $i++; - echo "\033[39m"; + echo "\033[39m"; $time = time(); $date = date("d:m:y h:i:s"); echo "[INFO] Processing server " . $server['name'] . PHP_EOL; @@ -60,7 +60,7 @@ } $egg = $server['egg']; $ee_egg = $server['egg']; - + $eggd = mysqli_query($conn, "SELECT * FROM mythicaldash_eggs WHERE id = '" . mysqli_real_escape_string($conn, $egg) . "'"); if ($eggd->num_rows == 0) { echo "\033[33m[WARNING $date] Egg does not exist." . PHP_EOL; @@ -81,6 +81,20 @@ $docker_image = $response['attributes']['docker_image']; $startup = $response['attributes']['startup']; $ports = $server['xtra_ports'] + 1; + $sql = "SELECT setting_name, setting_value FROM mythicaldash_eggs_config"; + $result = $conn->query($sql); + + $environment = array(); // Initialize an empty environment array + + if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + // Populate the 'environment' array with settings from the database + $settingName = $row["setting_name"]; + $settingValue = $row["setting_value"]; + $environment[$settingName] = $settingValue; + } + } + $panelcurl = curl_init(SettingsManager::getSetting("PterodactylURL") . "/api/application/servers"); $postfields = array( 'name' => $server['name'], @@ -89,82 +103,8 @@ 'nest' => $egg->nest, 'docker_image' => $docker_image, 'startup' => $startup, - 'environment' => array( - 'BUNGEE_VERSION' => "latest", - 'SERVER_JARFILE' => "server.jar", - 'BUILD_NUMBER' => "latest", - 'MC_VERSION' => 'latest', - 'BUILD_TYPE' => 'recommended', - 'SPONGE_VERSION' => '1.12.2-7.3.0', - 'VANILLA_VERSION' => 'latest', - 'NUKKIT_VERSION' => 'latest', - 'VERSION' => 'pm4', - 'MINECRAFT_VERSION' => 'latest', - 'BEDROCK_VERSION' => 'latest', - 'LD_LIBRARY_PATH' => '.', - 'GAMEMODE' => 'survival', - 'CHEATS' => 'false', - 'DIFFICULTY' => 'easy', - 'SERVERNAME' => 'My Bedrock Server', - 'PMMP_VERSION' => 'latest', - 'USER_UPLOAD' => 0, - 'AUTO_UPDATE' => 0, - 'BOT_JS_FILE' => 'index.js', - 'BOT_PY_FILE' => 'index.py', - 'TS_VERSION' => 'latest', - 'FILE_TRANSFER' => '30033', - 'MAX_USERS' => 100, - 'MUMBLE_VERSION' => 'latest', - 'REQUIREMENTS_FILE' => 'requirements.txt', - 'PY_FILE' => 'app.py', - 'GO_PACKAGE' => 'changeme', - 'EXECUTABLE' => 'changeme', - 'LUA_FILE' => 'app.lua', - 'LIT_PACKAGES' => '', - 'JS_FILE' => 'index.js', - 'JARFILE' => 'app.jar', - 'MAIN_FILE' => 'index.js', - 'PROJECT_FILE' => 'MyProject.sln', - 'PROJECT_DIR' => '/home/container', - 'PGUSER' => 'pterodactyl', - 'PGPASSWORD' => 'Pl3453Ch4n63M3!', - 'SERVER_PASSWORD' => "P@55w0rd", - "MONGO_USER" => "admin", - "MONGO_USER_PASS" => "", - "DRIVER_PORT" => "25568", - "HTTP_PORT" => "25569", - "FIVEM_LICENSE" => "", - "MAX_PLAYERS" => "48", - "SERVER_HOSTNAME" => "My new FXServer!", - "FIVEM_VERSION" => "recommended", - "STEAM_WEBAPIKEY" => "none", - "TXADMIN_PORT" => "40120", - "TXADMIN_ENABLE" => 0, - "SERVER_NAME" => "RAGE:MP Unofficial server", - "Version" => "R2-1", - "RCON_PASS" => "RCON_PASS", - "HOSTNAME" => "A Rust Server", - "OXIDE" => 0, - "LEVEL" => "Procedural Map", - "DESCRIPTION" => "Powered by Pterodactyl", - "WORLD_SIZE" => 3000, - "RCON_PORT" => 28016, - "SAVEINTERVAL" => 60, - "APP_PORT" => 28082, - "QUERY_PORT" => 10011, - "QUERY_PROTOCOLS_VAR" => "raw,http,ssh", - "QUERY_SSH" => 10022, - "QUERY_HTTP" => 10080, - "SRCDS_APPID" => "232250", - "SRCDS_MAP" => "cp_dustbowl", - "STEAM_ACC" => "kFXByFpKBNyNScAZNTmbfJhMDUXVdZrX", - "TICKRATE" => 22, - "LUA_REFRESH" => 0, - "ARK_ADMIN_PASSWORD" => "PleaseChangeMe", - "SERVER_MAP" => "TheIsland", - "SESSION_NAME" => "A Pterodactyl Hosted ARK Server", - "BATTLE_EYE" => 1 - ), + 'environment' => $environment, + // Include the 'environment' array here 'limits' => array( 'memory' => $server['ram'], 'swap' => $server['ram'], @@ -181,16 +121,22 @@ "locations" => [$locationd['locationid']], "dedicated_ip" => false, "port_range" => [] - )); + ) + ); + $postfields = json_encode($postfields, true); curl_setopt($panelcurl, CURLOPT_POST, 1); curl_setopt($panelcurl, CURLOPT_POSTFIELDS, $postfields); curl_setopt($panelcurl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($panelcurl, CURLOPT_HTTPHEADER, array( - 'Accept: application/json', - 'Content-Type: application/json', - 'Authorization: Bearer ' . SettingsManager::getSetting("PterodactylAPIKey") - )); + curl_setopt( + $panelcurl, + CURLOPT_HTTPHEADER, + array( + 'Accept: application/json', + 'Content-Type: application/json', + 'Authorization: Bearer ' . SettingsManager::getSetting("PterodactylAPIKey") + ) + ); $result = curl_exec($panelcurl); curl_close($panelcurl); $ee = json_decode($result, true); @@ -206,17 +152,16 @@ $svname = $server['name']; mysqli_query($conn, "DELETE FROM mythicaldash_servers_queue WHERE id=" . $server['id']); $created = date("d-m-y", time()); - if (mysqli_query($conn, 'INSERT INTO mythicaldash_servers (`pid`, `uid`, `location`, `egg_id`) VALUES ("'.$pid.'", "'.$uid.'", "'.$location.'", "'.$ee_egg.'")')) { + if (mysqli_query($conn, 'INSERT INTO mythicaldash_servers (`pid`, `uid`, `location`, `egg_id`) VALUES ("' . $pid . '", "' . $uid . '", "' . $location . '", "' . $ee_egg . '")')) { echo "\033[32m[SUCCESS] The server called " . $server['name'] . " got created."; //logClient("[$i/" . $queue->num_rows . "] The server called ``" . $server['name'] . "`` got created."); $conn->close(); die(); - } - else { + } else { echo "\033[31m[INFO] Error inserting server into db." . PHP_EOL; echo mysqli_error($conn); $conn->close(); die(); } } -?> +?> \ No newline at end of file diff --git a/migrate/38.sql b/migrate/38.sql new file mode 100644 index 00000000..a06eeae5 --- /dev/null +++ b/migrate/38.sql @@ -0,0 +1 @@ +CREATE TABLE `mythicaldash`.`mythicaldash_eggs_config` (`id` INT NOT NULL AUTO_INCREMENT , `setting_name` TEXT NOT NULL , `setting_value` TEXT NOT NULL , `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file diff --git a/migrate/39.sql b/migrate/39.sql new file mode 100644 index 00000000..a56d914b --- /dev/null +++ b/migrate/39.sql @@ -0,0 +1,73 @@ +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('BUNGEE_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SERVER_JARFILE', 'server.jar'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('BUILD_NUMBER', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MC_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('BUILD_TYPE', 'recommended'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('VANILLA_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('NUKKIT_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('VERSION', 'pm4'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MINECRAFT_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('BEDROCK_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('LD_LIBRARY_PATH', '.'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('GAMEMODE', 'survival'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('CHEATS', 'false'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('DIFFICULTY', 'easy'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SERVERNAME', 'My Bedrock Server'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('PMMP_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('USER_UPLOAD', '0'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('AUTO_UPDATE', '0'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('BOT_JS_FILE', 'index.js'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('BOT_PY_FILE', 'index.py'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('TS_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('FILE_TRANSFER', '30033'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MAX_USERS', '100'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MUMBLE_VERSION', 'latest'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('REQUIREMENTS_FILE', 'requirements.txt'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('PY_FILE', 'app.py'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('GO_PACKAGE', 'changeme'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('EXECUTABLE', 'changeme'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('LUA_FILE', 'app.lua'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('LIT_PACKAGES', ''); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('JS_FILE', 'index.js'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('JARFILE', 'app.jar'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MAIN_FILE', 'index.js'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('PROJECT_FILE', 'MyProject.sln'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('PROJECT_DIR', '/home/container'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('PGUSER', 'pterodactyl'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('PGPASSWORD', 'Pl3453Ch4n63M3!'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SERVER_PASSWORD', 'P@55w0rd'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MONGO_USER', 'admin'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MONGO_USER_PASS', ''); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('DRIVER_PORT', '25568'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('HTTP_PORT', '25569'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('FIVEM_LICENSE', ''); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('MAX_PLAYERS', '48'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SERVER_HOSTNAME', 'My new FXServer'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('FIVEM_VERSION', 'recommended'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('STEAM_WEBAPIKEY', 'none'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('TXADMIN_PORT', '40120'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('TXADMIN_ENABLE', '0'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SERVER_NAME', 'RAGE:MP Unofficial server'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('Version', 'R2-1'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('RCON_PASS', 'RCON_PASS'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('HOSTNAME', 'A Rust Server'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('OXIDE', '0'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('LEVEL', 'Procedural Map'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('DESCRIPTION', 'Powered by Pterodactyl'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('WORLD_SIZE', '3000'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('RCON_PORT', '28016'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SAVEINTERVAL', '60'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('APP_PORT', '28082'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('QUERY_PORT', '10011'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('QUERY_PROTOCOLS_VAR', 'raw,http,ssh'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('QUERY_SSH', '10022'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('QUERY_HTTP', '10080'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SRCDS_APPID', '232250'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SRCDS_MAP', 'cp_dustbowl'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('STEAM_ACC', 'kFXByFpKBNyNScAZNTmbfJhMDUXVdZrX'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('TICKRATE', '22'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('LUA_REFRESH', '0'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('ARK_ADMIN_PASSWORD', 'PleaseChangeMe'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SERVER_MAP', 'TheIsland'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('SESSION_NAME', 'A Pterodactyl Hosted ARK Server'); +INSERT INTO `mythicaldash_eggs_config` (`setting_name`, `setting_value`) VALUES ('BATTLE_EYE', '1'); diff --git a/routes/admin/eggs.php b/routes/admin/eggs.php index b94205fc..03dacfdf 100644 --- a/routes/admin/eggs.php +++ b/routes/admin/eggs.php @@ -9,9 +9,24 @@ require("../view/admin/eggs/create.php"); }); -$router->add("/admin/eggs", function () { +$router->add("/admin/eggs/list", function () { require("../include/main.php"); require("../view/admin/eggs/main.php"); }); + +$router->add("/admin/eggs/config", function () { + require("../include/main.php"); + require("../view/admin/eggs/manager_list.php"); +}); + +$router->add("/admin/eggs/config/create", function () { + require("../include/main.php"); + require("../view/admin/eggs/manager_create.php"); +}); + +$router->add("/admin/eggs/config/delete", function () { + require("../include/main.php"); + require("../view/admin/eggs/manager_delete.php"); +}); ?> \ No newline at end of file diff --git a/view/admin/api/main.php b/view/admin/api/main.php index 3796c80c..180597e3 100644 --- a/view/admin/api/main.php +++ b/view/admin/api/main.php @@ -1,5 +1,6 @@
- - - +
API Keys @@ -110,7 +102,8 @@ class="btn btn-primary float-end">Create New Key aria-label="Close">

Create new API Key!

-

Remember, this is an admin API key and can't be used for the client API endpoint.

+

Remember, this is an admin API key and cannot be used + for the client API endpoint.

diff --git a/view/admin/eggs/create.php b/view/admin/eggs/create.php index 4cf09770..06ede526 100644 --- a/view/admin/eggs/create.php +++ b/view/admin/eggs/create.php @@ -7,25 +7,25 @@ $nest_id = mysqli_real_escape_string($conn, $_GET['nest_id']); $nest_egg_id = mysqli_real_escape_string($conn, $_GET['nest_egg_id']); if ($name == "" || $category == "" || $nest_id == "" || $nest_egg_id == "" ) { - header('location: /admin/eggs?e=Please fill in all information.'); + header('location: /admin/eggs/list?e=Please fill in all information.'); die(); } else { $check_query = "SELECT * FROM mythicaldash_eggs WHERE egg = '$nest_egg_id'"; $result = mysqli_query($conn, $check_query); if (mysqli_num_rows($result) > 0) { - header('location: /admin/eggs?e=This egg exists in the database'); + header('location: /admin/eggs/list?e=This egg exists in the database'); $conn->close(); die(); } else { $conn->query("INSERT INTO `mythicaldash_eggs` (`name`, `category`, `egg`, `nest`) VALUES ('" . $name . "', '" . $category . "', '" . $nest_egg_id . "', '" . $nest_id . "');"); - header('location: /admin/eggs?s=Done we added a new egg'); + header('location: /admin/eggs/list?s=Done we added a new egg'); $conn->close(); die(); } } } else { - header('location: /admin/eggs'); + header('location: /admin/eggs/list'); die(); } ?> \ No newline at end of file diff --git a/view/admin/eggs/delete.php b/view/admin/eggs/delete.php index 2cc1d146..1456ce3c 100644 --- a/view/admin/eggs/delete.php +++ b/view/admin/eggs/delete.php @@ -11,28 +11,28 @@ $check_query = "SELECT * FROM mythicaldash_servers WHERE egg_id = '".mysqli_real_escape_string($conn,$_GET['id'])."'"; $resultl = mysqli_query($conn, $check_query); if (mysqli_num_rows($resultl) > 0) { - header("location: /admin/eggs?e=Sorry but there are some servers on this egg please delete them first!"); + header("location: /admin/eggs/list?e=Sorry but there are some servers on this egg please delete them first!"); $conn->close(); die(); } $check_query2 = "SELECT * FROM mythicaldash_servers_queue WHERE egg = '".mysqli_real_escape_string($conn,$_GET['id'])."'"; $result2 = mysqli_query($conn, $check_query2); if (mysqli_num_rows($result2) > 0) { - header("location: /admin/eggs?e=Sorry but there are some servers on this egg please delete them first!"); + header("location: /admin/eggs/list?e=Sorry but there are some servers on this egg please delete them first!"); $conn->close(); die(); } $conn->query("DELETE FROM `mythicaldash_eggs` WHERE `mythicaldash_eggs`.`id` = '".mysqli_real_escape_string($conn,$_GET['id'])."'"); - header("location: /admin/eggs?s=Done"); + header("location: /admin/eggs/list?s=Done"); $conn->close(); die(); } else { - header("location: /admin/eggs?e=Can't find a location in the database."); + header("location: /admin/eggs/list?e=Cannot find the egg in the database."); $conn->close(); die(); } } else { - header('location: /admin/eggs'); + header('location: /admin/eggs/list'); die(); } ?> \ No newline at end of file diff --git a/view/admin/eggs/main.php b/view/admin/eggs/main.php index d98e187b..35898b74 100644 --- a/view/admin/eggs/main.php +++ b/view/admin/eggs/main.php @@ -1,5 +1,6 @@
- - - +
@@ -72,7 +64,8 @@
Eggs - +
@@ -121,47 +114,48 @@
+ + + + + + + + + + num_rows > 0) { + while ($row = $result->fetch_assoc()) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } else { + echo ""; + } + ?> + +
IDNameValueAction
#" . $row['id'] . "" . $row['setting_name'] . "" . $row['setting_value'] . " Delete

No eggs found.

 
+
+
+ +
+ +
+
+ +
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/view/admin/locations/delete.php b/view/admin/locations/delete.php index 69e12818..f00d92a8 100644 --- a/view/admin/locations/delete.php +++ b/view/admin/locations/delete.php @@ -27,7 +27,7 @@ $conn->close(); die(); } else { - header("location: /admin/locations?e=Can't find a location in the database."); + header("location: /admin/locations?e=Cannot find the location in the database."); $conn->close(); die(); } diff --git a/view/admin/locations/main.php b/view/admin/locations/main.php index 468ed25e..82dd8310 100644 --- a/view/admin/locations/main.php +++ b/view/admin/locations/main.php @@ -1,5 +1,6 @@
- - - +
@@ -72,7 +64,8 @@
Locations - +
@@ -119,42 +112,43 @@
- + Create New Key

Create new redeem Key!

This redeem key can be claimed at: /earn/redeem

+ href="/earn/redeem"> + /earn/redeem +

diff --git a/view/components/sidebar.php b/view/components/sidebar.php index 1f0affed..1083bcc1 100644 --- a/view/components/sidebar.php +++ b/view/components/sidebar.php @@ -160,12 +160,24 @@ class="menu-item Locations
- +
-   - Delete +   + Delete +