frogot to stage

This commit is contained in:
bye 2024-06-29 22:52:46 +01:00
parent 7d0e608806
commit 6d280e4920
5 changed files with 72 additions and 1 deletions

View file

@ -38,6 +38,20 @@ $uri_explode = explode('?', $uri_string);
$path_raw = $uri_explode[0]; // `/foo/bar`
$path = explode('/', $path_raw);
if(isset($uri_explode[1])) {
$uri_string = $uri_explode[0];
$uri_explode = explode('&', $uri_explode[1]);
$query = array();
foreach($uri_explode as $string) {
$bits = explode('=', $string);
$query[$bits[0]] = $bits[1];
}
}
else {
$query = array();
}
// Remove trailing slashes
if (str_ends_with($path_raw, '/') && $path_raw != '/') {
http_response_code(308);
@ -53,7 +67,13 @@ $routes = [
if ($path[2] == 'signup') {
require 'views/signup.php';
exit;
} else if ($path[2] == 'login') {
require 'views/login.php';
exit;
}
return 404;
},
'profile' => function () {
global $path, $user, $profile_owner; // don't forget this lol

View file

@ -38,6 +38,10 @@ main {
footer {
flex: 0;
text-align: center;
margin: 16px;
}
#content {

View file

@ -0,0 +1,45 @@
<?php
if ($_SESSION['auth']) {
if (key_exists('callback', $query)) {
header('Location: ' . $query['callback']);
} else {
header('Location: /dashboard');
}
exit();
}
?>
<!doctype html>
<html lang="en">
<head>
<?php include 'partials/head.php' ?>
</head>
<body>
<?php include 'partials/header.php' ?>
<main><?php
if ($_SESSION['auth']) {
$error_body = get_string('error.loggedIn');
include 'partials/error.php';
}
?>
<h1>Sign up</h1>
<form method="post">
<p><label for="email">Email</label>
<input type="email" name="email" id="email" /></p>
<p><label for="password">Password</label>
<input type="password" name="password" id="password" /></p>
<p><label for="repeat_password">Confirm password</label>
<input type="password" name="repeat_password" id="repeat_password" /></p>
<button type="submit">Submit</button>
</form>
</main>
<?php include 'partials/footer.php' ?>
</body>
</html>

View file

@ -1,3 +1,4 @@
<footer>
<b>Execution time: </b> <?= round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 3) ?> ms
<div>&copy; ByeCorps 2024 :: <a href="/credits"><?= get_string('page.credits') ?></a></div>
<div><b><?= get_string('footer.executionTime') ?>: </b> <?= round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 3) ?> ms</div>
</footer>

View file

@ -8,5 +8,6 @@
<div>
<a href="/auth/signup"><?= get_string("auth.signup") ?></a>
<a href="/auth/login"><?= get_string("auth.login") ?></a>
</div>
</header>