SiDoMan/pages/login.php

50 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2020-10-23 21:12:36 +00:00
<?php
if(isset($_SESSION['LOGIN']))
{
if($_SESSION['LOGIN'] == 'true')
{
include "./pages/dashboard.php";
die();
}
}
2020-10-23 21:26:23 +00:00
if(isset($_POST['do-login']))
2020-10-23 21:12:36 +00:00
{
2020-10-23 21:26:23 +00:00
if(isset($_POST['containername']) || isset($_POST['accesskey']))
2020-10-23 21:12:36 +00:00
{
2020-10-23 21:26:23 +00:00
$dockerClient = new Docker();
$allContainers = $dockerClient->getAllContainers();
$container = NULL;
2020-10-23 21:12:36 +00:00
2020-10-23 21:26:23 +00:00
foreach($allContainers as $thisContainer)
2020-10-23 21:12:36 +00:00
{
2020-10-23 22:17:05 +00:00
if(trim($_POST['containername']) == trim(ltrim($thisContainer['Names']['0'], '/')))
2020-10-23 22:14:18 +00:00
{
2020-10-23 22:16:13 +00:00
if(isset($thisContainer['Labels']['remotepass']))
2020-10-23 22:14:18 +00:00
{
2020-10-23 22:16:13 +00:00
if(trim($thisContainer['Labels']['remotepass']) == trim($_POST['accesskey']))
{
$container = $thisContainer;
}
2020-10-23 22:14:18 +00:00
}
}
2020-10-23 21:12:36 +00:00
}
2020-10-23 21:26:23 +00:00
if($container != NULL)
{
$_SESSION['LOGIN'] = "true";
2020-10-23 21:49:01 +00:00
$_SESSION['CONTAINER'] = trim(ltrim($container['Names']['0'], '/'));
2020-10-23 21:12:36 +00:00
2020-10-24 11:34:47 +00:00
header("Location: index.php");
2020-10-23 21:26:23 +00:00
die();
}
}
2020-10-23 21:12:36 +00:00
}
2020-10-23 21:31:32 +00:00
2020-10-23 21:26:23 +00:00
$HTML = new HTML();
$HTML->setHTMLTitle("Login");
$HTML->importHTML("style/default/login.html");
2020-10-23 21:12:36 +00:00
$HTML->build();
echo $HTML->ausgabe();
?>