-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
53 lines (51 loc) · 1.69 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
session_start();
include "util.php";
$envs = getEnvVars();
$username = isset($envs["USERNAME"]) ? $envs["USERNAME"]: "";
$password = isset($envs["PASSWORD"]) ? $envs["PASSWORD"] : "";
if (isset($_SESSION["username"]) && isset($_SESSION["password"])) {
header("Location: env.php");
}
include "header.php";
?>
<div class="sidebar-content">
<div id="login-form">
<?php
// show login if username and password are set
if (!empty($username) && !empty($password)) {
include "login-form.php";
}
?>
<?php
// if either username || password are not set allow user to set password
if (empty($username) || empty($password)) {
include "setup-form.php";
}
?>
<?php if(isset($_GET["error"])):?>
<script>
setBanner("<?= $_GET["error"]?>", "error");
</script>
<?php endif; ?>
<?php if(isset($_GET["success"])):?>
<script>
setBanner("<?= $_GET["success"]?>", "success");
</script>
<?php endif; ?>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
var urlElement = document.getElementById('app-url');
if (urlElement) {
urlElement.href= window.origin;
urlElement.innerHTML = window.origin;
}
var appDashboardUrlElement = document.getElementById('app-dashboard-url');
if (appDashboardUrlElement) {
appDashboardUrlElement.href = 'https://dash.appbase.io?url='+window.origin;
}
});
</script>
<?php include "footer.php"; ?>