This commit is contained in:
Christopher 2020-10-23 22:53:31 +02:00
parent fed94662cc
commit 9ef9241205
1 changed files with 41 additions and 0 deletions

41
pages/do.php Normal file
View File

@ -0,0 +1,41 @@
<?php
if(isset($_SESSION['LOGIN']))
{
if($_SESSION['LOGIN'] == 'true')
{
$dockerClient = new Docker();
$allContainers = $dockerClient->getAllContainers();
$container = NULL;
foreach($allContainers as $thisContainer)
if($thisContainer['Id'] == $_SESSION['CONTAINER'] || $_SESSION['CONTAINER'] == ltrim($thisContainer['Names']['0'], '/'))
$container = $thisContainer;
if($container == NULL)
die("unknown container");
if(isset($_REQUEST['do-start']))
$dockerClient->startContainer($thisContainer['Id']);
if(isset($_REQUEST['do-stop']))
$dockerClient->stopContainer($thisContainer['Id']);
if(isset($_REQUEST['do-kill']))
$dockerClient->killContainer($thisContainer['Id']);
if(isset($_REQUEST['do-restart']))
{
$dockerClient->killContainer($thisContainer['Id']);
$dockerClient->startContainer($thisContainer['Id']);
}
include "./pages/dashboard.php";
}else{
die("Login is not valid!");
}
}else{
die("Access denied!");
}
?>