From d614d91c38802110bc51613658c45eac84d9bb21 Mon Sep 17 00:00:00 2001 From: Pentium44 Date: Wed, 10 Feb 2021 10:59:17 -0800 Subject: [PATCH] Tweaks, and admin feature sets --- index.php | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index 13dd1251..51f18940 100755 --- a/index.php +++ b/index.php @@ -52,7 +52,7 @@ $username = $_SESSION['mtm-user']; -Free Minetest / MultiCraft Server Hosting! +<?php echo $mtsmtitle; ?> "> @@ -772,7 +772,7 @@ else if(isset($_GET['do'])) $username = stripslashes(htmlentities($_POST['username'])); if($username == "admin") { if($admin_passwd == stripslashes(htmlentities($_POST['password']))) { - $pass = $admin_passwd; + $pass = sha1(md5($admin_passwd)); $user = $username; $_SESSION['mtm-user'] = $user; $_SESSION['mtm-pass'] = $pass; @@ -796,6 +796,43 @@ else if(isset($_GET['do'])) } } + if($do=="admin-start-all") { + if($username=="admin" && $_SESSION['mtm-pass']==sha1(md5($admin_passwd))) { + // To be continued! + chdir("mtm_db/users"); + echo "Starting servers..."; + foreach(glob("*.php") as $user_account_file) { + include_once($user_account_file); + $servertype = file_get_contents("$userid.type"); + $serverstatus = file_get_contents("$userid.pid.status"); + $statuscode = file_get_contents("$userid.pid.statuscode"); + if(!file_exists("$userid.pid.statuscode") || $statuscode == "false") { + chdir(".."); + if($servertype == "multicraft" && is_dir("worlds/$userid/bin")) { + file_put_contents("events/$userid", "./server start-multicraft $userid"); + sleep(1); + echo "Starting multicraft world $userid...
"; + } else if($servertype == "minetest" && is_dir("worlds/$userid/bin")) { + file_put_contents("events/$userid", "./server start-minetest $userid"); + sleep(1); + echo "Starting minetest world $userid...
"; + } else { + echo "World not created for $userid...
"; + } + chdir("users"); + } + } + } + } + + if($do=="admin-stop-all") { + if($username=="admin" && $_SESSION['mtm-pass']==sha1(md5($admin_passwd))) { + echo "Stopping servers..."; + if(!isset($userid)) { $userid = "1"; } + file_put_contents("mtm_db/events/$userid", "./server stopall"); + } + } + if($do=="logout") { $_SESSION['mtm-user'] = null; @@ -949,6 +986,11 @@ else fclose($fhcpu); + // Admin server controls. + echo "
"; + echo "Start All"; + echo "Stop All
"; + // To be continued! chdir("mtm_db/users"); echo ""; @@ -966,13 +1008,6 @@ else

Powered By MTSM
-Possible thanks to:
- - - - - -
UsernameFull NameEmailServer-Type/PortUser IDServer Stat