75 lines
2.0 KiB
PHP
75 lines
2.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
session_start();
|
|
|
|
$loggedIn = !empty($_SESSION['tt_logged_in']);
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
<title>Trailer Trekker</title>
|
|
<link rel="stylesheet" href="/styles.css">
|
|
</head>
|
|
<body>
|
|
<?php if (!$loggedIn): ?>
|
|
<div class="page">
|
|
<div class="card auth">
|
|
<h1>Trailer Trekker</h1>
|
|
<p class="muted">Login</p>
|
|
|
|
<form class="form" method="post" action="/api/login.php">
|
|
<label>
|
|
<span>Username</span>
|
|
<input name="username" autocomplete="username" required />
|
|
</label>
|
|
|
|
<label>
|
|
<span>Password</span>
|
|
<input type="password" name="password" autocomplete="current-password" required />
|
|
</label>
|
|
|
|
<?php if (!empty($_GET['err'])): ?>
|
|
<div class="error">Invalid username or password.</div>
|
|
<?php endif; ?>
|
|
|
|
<button class="btn primary" type="submit">Login</button>
|
|
</form>
|
|
|
|
<p class="muted small">
|
|
Tip: This is a single-user site; credentials live in <code>/var/www/TRAILER_TREKKER/private/config.php</code>.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<header class="topbar">
|
|
<div class="brand">
|
|
<div class="title">Trailer Trekker</div>
|
|
<div class="subtitle">Trips • Lists • Checklists • Upgrades • Fixes</div>
|
|
</div>
|
|
|
|
<div class="topbar-actions">
|
|
<button id="btnExport" class="btn">Export</button>
|
|
<label class="btn file-btn">
|
|
Import
|
|
<input id="fileImport" type="file" accept="application/json" hidden />
|
|
</label>
|
|
<button id="btnLogout" class="btn danger">Logout</button>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container">
|
|
<nav class="tabs" id="tabs"></nav>
|
|
<section id="content" class="content"></section>
|
|
<footer class="footer">
|
|
<span id="status" class="muted"></span>
|
|
</footer>
|
|
</main>
|
|
|
|
<script src="/app.js"></script>
|
|
<?php endif; ?>
|
|
</body>
|
|
</html>
|