Tweaks, and admin feature sets
This commit is contained in:
parent
56d103a23b
commit
d614d91c38
53
index.php
53
index.php
@ -52,7 +52,7 @@ $username = $_SESSION['mtm-user'];
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en-us">
|
<html lang="en-us">
|
||||||
<head>
|
<head>
|
||||||
<title>Free Minetest / MultiCraft Server Hosting!</title>
|
<title><?php echo $mtsmtitle; ?></title>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=.55, shrink-to-fit=yes"><meta name="description" content="<?php echo htmlentities($mtsmtitle) . " - " . $desc; ?>">
|
<meta name="viewport" content="width=device-width, initial-scale=.55, shrink-to-fit=yes"><meta name="description" content="<?php echo htmlentities($mtsmtitle) . " - " . $desc; ?>">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
@ -772,7 +772,7 @@ else if(isset($_GET['do']))
|
|||||||
$username = stripslashes(htmlentities($_POST['username']));
|
$username = stripslashes(htmlentities($_POST['username']));
|
||||||
if($username == "admin") {
|
if($username == "admin") {
|
||||||
if($admin_passwd == stripslashes(htmlentities($_POST['password']))) {
|
if($admin_passwd == stripslashes(htmlentities($_POST['password']))) {
|
||||||
$pass = $admin_passwd;
|
$pass = sha1(md5($admin_passwd));
|
||||||
$user = $username;
|
$user = $username;
|
||||||
$_SESSION['mtm-user'] = $user;
|
$_SESSION['mtm-user'] = $user;
|
||||||
$_SESSION['mtm-pass'] = $pass;
|
$_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...<br />";
|
||||||
|
} 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...<br />";
|
||||||
|
} else {
|
||||||
|
echo "World not created for $userid...<br />";
|
||||||
|
}
|
||||||
|
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")
|
if($do=="logout")
|
||||||
{
|
{
|
||||||
$_SESSION['mtm-user'] = null;
|
$_SESSION['mtm-user'] = null;
|
||||||
@ -949,6 +986,11 @@ else
|
|||||||
|
|
||||||
fclose($fhcpu);
|
fclose($fhcpu);
|
||||||
|
|
||||||
|
// Admin server controls.
|
||||||
|
echo "<br />";
|
||||||
|
echo "<a href='index.php?do=admin-start-all' class='button'>Start All</a>";
|
||||||
|
echo "<a href='index.php?do=admin-stop-all' class='button'>Stop All</a><br />";
|
||||||
|
|
||||||
// To be continued!
|
// To be continued!
|
||||||
chdir("mtm_db/users");
|
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><td>Server Stat</td></tr>";
|
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>";
|
||||||
@ -966,13 +1008,6 @@ else
|
|||||||
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<div style="margin: auto; width: 100%; text-align: center; background-color: #555555; padding: 3px;">Powered By <a href="https://notabug.org/Pentium44/MTSM">MTSM</a> <?php echo $version; ?> <br />
|
<div style="margin: auto; width: 100%; text-align: center; background-color: #555555; padding: 3px;">Powered By <a href="https://notabug.org/Pentium44/MTSM">MTSM</a> <?php echo $version; ?> <br />
|
||||||
Possible thanks to:<br />
|
|
||||||
<a href="https://freedns.afraid.org/">
|
|
||||||
<img style="width:100px;" src="https://freedns.afraid.org/images/freedns_crop.png" />
|
|
||||||
</a>
|
|
||||||
<a href="https://letsencrypt.org/">
|
|
||||||
<img style="width: 100px;" src="https://letsencrypt.org/images/le-logo-wide.png" />
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- main contain -->
|
</div> <!-- main contain -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user