rewrote some stuff

master
BodgeMaster 2020-03-05 03:35:16 +01:00
parent 94d4de68ef
commit 5771bc2d15
1 changed files with 11 additions and 11 deletions

View File

@ -34,17 +34,8 @@ echo "Done.";
} else {
echo "<a href=\"\"><button> Return to regular status commands </button></a><hr />";
}
?>
<?php
// run ondemand command list if demanded
if (isset($_POST['ondemand'])) {
foreach ($ondemand_commands as $command) {
$output = shell_exec($command);
echo "<pre class=\"commandLine\"> $command </pre>\n<pre class=\"commandLine\"> $output </pre>\n<hr />";
}
} else {
//run status command list otherwise
foreach ($status_commands as $command) {
function execute_command_list($commands){
foreach ($commands as $command) {
if ($command != ""){
// === is here on purpose.
if (strpos($command, '>') === false) {
@ -54,6 +45,15 @@ echo "Done.";
echo "<pre class=\"commandLine\"> $command </pre>\n<pre class=\"commandLine\"> $output </pre>\n<hr />";
}
}
}
// run ondemand command list if demanded
if (isset($_POST['ondemand'])) {
execute_command_list($ondemand_commands);
} else {
//run status command list otherwise
execute_command_list($status_commands);
}
?>
</body>