kontrolvm/index.php
KuJoe e0bc51ed10 Initial upload for release 0.1
Uploading the code in its entirety, basic testing completed but still more work and code clean-up needed.
2025-02-10 17:36:04 -05:00

118 lines
No EOL
2.8 KiB
PHP

<?php
/** KontrolVM By KuJoe (https://github.com/KuJoe/kontrolvm) **/
session_start();
if (isset($_SESSION["loggedin"]) AND $_SESSION["loggedin"] == true) {
define('AmAllowed', TRUE);
header("Location: home.php");
}
require_once('config.php');
if(isset($_GET['e'])) {
if($_GET['e'] == '0') {
$error = 'Incorrect username or password.';
} elseif($_GET['e'] == '1') {
$error = "CAPTCHA failed.";
} elseif($_GET['e'] == '2') {
$error = "User is locked out or not active.";
} else {
$error = "Login failed.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KontrolVM</title>
<style>
body {
font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f4f4f7;
}
.login-container {
background-color: #fff;
padding: 40px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
}
h2 {
text-align: center;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
}
input[type="text"],
input[type="password"] {
width: 100%;
padding: 10px;
border: 1px solid #ced4da;
border-radius: 4px;
box-sizing: border-box;
}
button[type="submit"] {
background-color: #28a745;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
.error-message {
color: #dc3545;
background-color: #f8d7da;
border: 1px solid #f5c6cb;
padding: 10px;
margin-bottom: 15px;
border-radius: 4px;
text-align: center;
}
</style>
</head>
<body>
<div class="login-container">
<img src="assets/logo.png" alt="KontrolVM Logo" style="display:block;margin:0 auto;" />
<br />
<br />
<?php if (isset($error)) { ?>
<div class="error-message"><?php echo $error; ?></div>
<?php } ?>
<form action="auth.php" method="post">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="username" maxlength="50" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="password" maxlength="50" required>
</div>
<?php if(isset($sitekey)) { ?>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" defer></script>
<div class="cf-turnstile" data-sitekey="<?php echo $sitekey; ?>"></div>
<?php } ?>
<button type="submit">Login</button>
</form>
<br /><br />
<p style="text-align:center;font-size:0.9em;">Powered by <a href="https://github.com/KuJoe/kontrolvm" target="_blank">KontrolVM</a></p>
</div>
</body>
</html>