Bug fixes...

master
Pentium44 2021-02-10 10:06:01 -08:00
parent a1c4fcae8e
commit 56d103a23b
2 changed files with 52 additions and 13 deletions

View File

@ -219,6 +219,7 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Pending: Server is pending creation, this process shouldn't take longer than 30 seconds...";
echo "<meta http-equiv='refresh' content='3,url=index.php?do=configure-mods' />";
} else {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
if($serverstatus == "false") {
@ -246,6 +247,7 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Pending: Server is pending creation, this process shouldn't take longer than 30 seconds...";
echo "<meta http-equiv='refresh' content='3,url=index.php?do=configure-mods' />";
} else {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
if($serverstatus == "false") {
@ -320,6 +322,7 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Pending: Server is pending creation, this process shouldn't take longer than 30 seconds...";
echo "<meta http-equiv='refresh' content='3' />";
} else {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
if($serverstatus == "false") {
@ -356,6 +359,7 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Pending: Server is pending creation, this process shouldn't take longer than 30 seconds...";
echo "<meta http-equiv='refresh' content='3' />";
} else {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
if($serverstatus == "false") {
@ -393,6 +397,7 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Pending: Server is pending creation, this process shouldn't take longer than 30 seconds...";
echo "<meta http-equiv='refresh' content='3' />";
} else {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
if($serverstatus == "false" || !file_exists("mtm_db/users/$userid.pid")) {
@ -419,6 +424,7 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Pending: Server is pending creation, this process shouldn't take longer than 30 seconds...";
echo "<meta http-equiv='refresh' content='3' />";
} else {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
if($serverstatus == "true") {
@ -465,8 +471,8 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
// Refresh the page every 5 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='5' />";
// Refresh the page every 3 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='3' />";
} else {
echo $username . "'s Server<br /> Server status: ";
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.status");
@ -494,8 +500,8 @@ else if(isset($_GET['do']))
if(is_dir("mtm_db/worlds/$userid")) {
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
// Refresh the page every 5 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='5' />";
// Refresh the page every 3 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='3' />";
} else {
// Check if usermods folder exists, create if not!
@ -565,7 +571,7 @@ else if(isset($_GET['do']))
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
// Refresh the page every 5 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='5' />";
echo "<meta http-equiv='refresh' content='3' />";
} else {
// Lets checkout what's being uploaded
if(isset($_POST['upload-btn'])) {
@ -610,7 +616,7 @@ else if(isset($_GET['do']))
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
// Refresh the page every 5 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='5' />";
echo "<meta http-equiv='refresh' content='3' />";
} else {
echo $username . "'s Server<br /> Server status: ";
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.status");
@ -653,7 +659,7 @@ else if(isset($_GET['do']))
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
// Refresh the page every 5 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='5' />";
echo "<meta http-equiv='refresh' content='3' />";
} else {
if(is_dir("mtm_db/worlds/$userid/worlds/world/worldmods")) {
$serverstatus = file_get_contents("mtm_db/users/$userid.pid.statuscode");
@ -682,7 +688,7 @@ else if(isset($_GET['do']))
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Please wait: Server is being created, this process shouldn't take longer than 30 seconds...";
// Refresh the page every 5 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='5' />";
echo "<meta http-equiv='refresh' content='3' />";
} else {
if(is_dir("mtm_db/usermods/$username")) {
file_put_contents("mtm_db/events/$userid", "rm -r mtm_db/usermods/$username/*");
@ -709,7 +715,7 @@ else if(isset($_GET['do']))
// Lets setup a default configuration script
$config_contents = "port = 30" . $userid . "\n";
$config_contents .= "name = " . $username . "\n";
$config_contents .= "max_users = 25\n";
$config_contents .= "max_users = $max_slot_count\n";
$config_contents .= "default_game = minetest_game\n";
$config_contents .= "default_privs = shout, interact\n";
$config_contents .= "secure.trusted_mods = irc\n";
@ -735,7 +741,7 @@ else if(isset($_GET['do']))
if(!is_dir("mtm_db/worlds/$userid/bin")) {
echo "Server doesn't exist... unable to remove debug.txt";
// Refresh the page every 5 seconds for updates on the VM status.
echo "<meta http-equiv='refresh' content='5' />";
echo "<meta http-equiv='refresh' content='3' />";
} else {
// Lets setup a default configuration script
if(!file_exists("mtm_db/users/$userid.slog")) {
@ -911,13 +917,46 @@ else
include_once("mtm_db/token.php");
echo "<p>Current registration token: $reg_token</p>";
echo "<h3>Server information</h3>";
// Open system meminfo
$fhmem = fopen('/proc/meminfo','r');
// Open system loadavg
$fhcpu = fopen('/proc/loadavg','r');
// Set to 0 for population
$memavail = 0;
$memfree = 0;
while ($line = fgets($fhmem)) {
$piecesavail = array();
$piecesfree = array();
if (preg_match('/^MemTotal:\s+(\d+)\skB$/', $line, $piecesavail)) {
$memavail = $piecesavail[1];
}
if (preg_match('/^MemAvailable:\s+(\d+)\skB$/', $line, $piecesfree)) {
$memfree = $piecesfree[1];
break;
}
}
fclose($fhmem);
echo round(($memavail/1024)) . " MB RAM found, " . round(($memfree/1024)) . " MB RAM free<br />\n";
while ($line = fgets($fhcpu)) {
echo "Load: " . $line;
}
fclose($fhcpu);
// To be continued!
chdir("mtm_db/users");
echo "<table><tr><td>Username</td><td>Full Name</td><td>Email</td><td>Server-Type/Port</td><td>User ID</td>";
echo "<table><tr><td>Username</td><td>Full Name</td><td>Email</td><td>Server-Type/Port</td><td>User ID</td><td>Server Stat</td></tr>";
foreach(glob("*.php") as $user_account_file) {
include_once($user_account_file);
$servertype = file_get_contents("$userid.type");
echo "<tr><td>$user_handle</td><td>$user_fullname</td><td>$user_email</td><td>$servertype/$portrange$userid</td><td>$userid</td>";
$serverstatus = file_get_contents("$userid.pid.status");
echo "<tr><td>$user_handle</td><td>$user_fullname</td><td>$user_email</td><td>$servertype/$portrange$userid</td><td>$userid</td><td>$serverstatus</td></tr>";
}
echo "</table>";
}

View File

@ -1,5 +1,5 @@
<?php
// We're gonna stuff this here so git shuts up on pull requests.
$version = "1.2"; // version of MTSM
$version = "1.2.1"; // version of MTSM
?>