Auto stash before merge of "main" and "origin/main"

This commit is contained in:
2024-02-09 21:11:19 -06:00
parent f5d267ea98
commit d21d91b80e
17 changed files with 844 additions and 7 deletions

42
views/auth/register.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
// Check if the user is already logged in
if (isset($_SESSION['user_id'])) {
// Redirect to the dashboard if the user is already logged in
header('Location: /dashboard');
exit;
}
// Include error handling
$error = $_SESSION['error'] ?? '';
unset($_SESSION['error']); // Clear the error after displaying
$content = function() use ($error) { ?>
<div class="row justify-content-center">
<div class="col-md-6">
<h2 class="mt-5">Register</h2>
<?php if ($error): ?>
<div class="alert alert-danger" role="alert">
<?= htmlspecialchars($error) ?>
</div>
<?php endif; ?>
<form action="/register" method="post">
<div class="form-group">
<label for="username">Username</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
<p class="mt-3">Already have an account? <a href="/">Login here</a>.</p>
</div>
</div>
<?php };
include __DIR__ . '/../layouts/app.php';