diff --git a/scripts/halt.php b/scripts/halt.php index bd5a45c..c4fdb7c 100644 --- a/scripts/halt.php +++ b/scripts/halt.php @@ -8,6 +8,14 @@ $start = $time; include "../config/config.php"; include "../include/tools.php"; include "../include/functions.php"; +if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; +} else { + if ($_SERVER['PHP_AUTH_USER'] == HALTUSER && $_SERVER['PHP_AUTH_PW'] == HALTPW) { + $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; ?> @@ -58,7 +66,15 @@ $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); -echo ''; +echo ''; + } else { + + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; + } + } ?> | get your own at: https://github.com/dg9vh/MMDVMHost-Dashboard diff --git a/scripts/log.php b/scripts/log.php index 7cfc8d5..1991de7 100644 --- a/scripts/log.php +++ b/scripts/log.php @@ -9,7 +9,14 @@ include "../config/config.php"; include "../include/tools.php"; include "../include/functions.php"; -$fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; +if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; +} else { + if ($_SERVER['PHP_AUTH_USER'] == VIEWLOGUSER && $_SERVER['PHP_AUTH_PW'] == VIEWLOGPW) { + $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; ?> @@ -81,7 +88,6 @@ while (!$file->eof()) { // Unset the file to call __destruct(), closing the file handle. $file = null; - ?> @@ -99,6 +105,14 @@ $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo ''; + } else { + + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; + } + } ?> | get your own at: https://github.com/dg9vh/MMDVMHost-Dashboard - - + } );}); diff --git a/scripts/reboot.php b/scripts/reboot.php index cef12e9..99e84a7 100644 --- a/scripts/reboot.php +++ b/scripts/reboot.php @@ -8,6 +8,15 @@ $start = $time; include "../config/config.php"; include "../include/tools.php"; include "../include/functions.php"; +if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; +} else { + if ($_SERVER['PHP_AUTH_USER'] == REBOOTUSER && $_SERVER['PHP_AUTH_PW'] == REBOOTPW) { + $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; + ?> @@ -58,6 +67,14 @@ $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo ''; + } else { + + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; + } + } ?> | get your own at: https://github.com/dg9vh/MMDVMHost-Dashboard diff --git a/scripts/rebootmmdvm.php b/scripts/rebootmmdvm.php index 3db6d26..f5c2ca3 100644 --- a/scripts/rebootmmdvm.php +++ b/scripts/rebootmmdvm.php @@ -9,6 +9,14 @@ $start = $time; include "../config/config.php"; include "../include/tools.php"; include "../include/functions.php"; +if (!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; +} else { + if ($_SERVER['PHP_AUTH_USER'] == RESTARTUSER && $_SERVER['PHP_AUTH_PW'] == RESTARTPW) { + $fileName = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; ?> @@ -59,7 +67,15 @@ $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); -echo ''; +echo ''; + } else { + + header('WWW-Authenticate: Basic realm="Dashboard"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Zur Ausführung bitte die geforderten Login-Daten eingeben!'; + exit; + } + } ?> | get your own at: https://github.com/dg9vh/MMDVMHost-Dashboard diff --git a/setup.php b/setup.php index fe25bd4..3059158 100644 --- a/setup.php +++ b/setup.php @@ -151,6 +151,38 @@ include "include/tools.php"; Enable Management-Functions below
>
+
+ Username for view log: + " name="VIEWLOGUSER" class="form-control" placeholder="username" aria-describedby="VIEWLOGUSER"> +
+
+ Password for view log: + " name="VIEWLOGPW" class="form-control" placeholder="password" aria-describedby="VIEWLOGPW"> +
+
+ Username for halt: + " name="HALTUSER" class="form-control" placeholder="username" aria-describedby="HALTUSER"> +
+
+ Password for halt: + " name="HALTPW" class="form-control" placeholder="password" aria-describedby="HALTPW"> +
+
+ Username for reboot: + " name="REBOOTUSER" class="form-control" placeholder="username" aria-describedby="REBOOTUSER"> +
+
+ Password for reboot: + " name="REBOOTPW" class="form-control" placeholder="password" aria-describedby="REBOOTPW"> +
+
+ Username for restart: + " name="RESTARTUSER" class="form-control" placeholder="username" aria-describedby="RESTARTUSER"> +
+
+ Password for restart: + " name="RESTARTPW" class="form-control" placeholder="password" aria-describedby="RESTARTPW"> +
Reboot MMDVMHost command: " name="REBOOTMMDVM" class="form-control" placeholder="sudo systemctl restart mmdvmhost.service" aria-describedby="REBOOTMMDVM"> diff --git a/version.php b/version.php index 21a8baf..6caf628 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@