Initial setup, not working yet

This commit is contained in:
2026-06-12 15:08:50 +03:00
parent 2aba4b03a4
commit a467754d6c
37 changed files with 1211 additions and 4 deletions

79
frontend/login.php Normal file
View File

@@ -0,0 +1,79 @@
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once "api/client.php";
$error = null;
if ($_POST) {
$response = api_request(
"POST",
"/auth/login",
[
"username" => $_POST["username"],
"password" => $_POST["password"]
]
);
if ($response) {
setcookie(
"token",
$response,
time() + 86400,
"/"
);
header("Location: items.php");
exit;
} else {
$error = "Invalid login";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<div class="container">
<h1>Login</h1>
<?php if ($error): ?>
<p><?= $error ?></p>
<?php endif; ?>
<form method="POST">
<input
name="username"
placeholder="Username"
required
>
<input
name="password"
type="password"
placeholder="Password"
required
>
<button type="submit">
Login
</button>
</form>
</div>
</body>
</html>