You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
if (isset($_POST['username']) && isset($_POST['password']))
|
|
{
|
|
require 'config/application.php';
|
|
$username = trim($_POST['username']);
|
|
$password = trim($_POST['password']);
|
|
|
|
if (!isset($GLOBALS['appconf']['users'][$username]))
|
|
die('Incorrect user or password');
|
|
$pass_hash = hash_hmac('sha256', $password, $GLOBALS['appconf']['users_hash_secret']);
|
|
if ($pass_hash !== $GLOBALS['appconf']['users'][$username])
|
|
die('Incorrect user or password');
|
|
|
|
$session = $username.'.'.sha1(strval(microtime(true).$pass_hash));
|
|
setcookie('_session', $session);
|
|
file_put_contents('/tmp/apcontrol-sessions', $session."\n", FILE_APPEND);
|
|
header('Location: ..');
|
|
die;
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Soselo - Login</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="icon" type="image/x-icon" href="img/favicon.png">
|
|
<link rel="stylesheet" href="fonts/forkawesome/css/fork-awesome.min.css">
|
|
</head>
|
|
<body>
|
|
|
|
<?php require 'css/base.php' ?>
|
|
|
|
<main class="flex">
|
|
<div class="center">
|
|
<h3 class="flex">
|
|
<img src="img/favicon.png" style="width: 2em; height: 2em; margin: auto 0">
|
|
<span style="padding: .4em .8em;">Soselo Tool</span>
|
|
</h3>
|
|
<form action="login.php" method="POST">
|
|
<input type="text" name="username" placeholder="Username"/>
|
|
<br><div style="margin-bottom:.5em"></div>
|
|
<input type="password" name="password" placeholder="Password"/>
|
|
<br><br>
|
|
<input type="submit" class="btn w100" value="Log in"/>
|
|
</form>
|
|
</div>
|
|
</main>
|
|
|
|
<?php require 'js/base.php' ?>
|
|
|
|
<script>
|
|
window.onload = function(e) {
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|