Cleans up login and register pages.

main
Yasen Pramatarov 2024-08-06 10:40:52 +03:00
parent 6199dad2c6
commit 15c97859a4
6 changed files with 56 additions and 27 deletions

View File

@ -65,6 +65,7 @@ if (isset($_GET['page'])) {
} }
// check if logged in // check if logged in
unset($user);
if (isset($_COOKIE['username'])) { if (isset($_COOKIE['username'])) {
if ( !isset($_SESSION['username']) ) { if ( !isset($_SESSION['username']) ) {
$_SESSION['username'] = $_COOKIE['username']; $_SESSION['username'] = $_COOKIE['username'];
@ -107,15 +108,21 @@ if (in_array($page, $allowed_urls)) {
include 'templates/page-header.php'; include 'templates/page-header.php';
include 'templates/page-menu.php'; include 'templates/page-menu.php';
include 'templates/block-message.php'; include 'templates/block-message.php';
if (isset($user)) {
include 'templates/page-sidebar.php'; include 'templates/page-sidebar.php';
}
include "pages/{$page}.php"; include "pages/{$page}.php";
} }
// the page is not in allowed urls, loading front page // the page is not in allowed urls, loading front page
} else { } else {
$error = 'The page "' . $page . '" is not found';
include 'templates/page-header.php'; include 'templates/page-header.php';
include 'templates/page-menu.php'; include 'templates/page-menu.php';
include 'templates/block-message.php'; include 'templates/block-message.php';
if (isset($user)) {
include 'templates/page-sidebar.php';
}
include 'pages/front.php'; include 'pages/front.php';
} }
include 'templates/page-footer.php'; include 'templates/page-footer.php';

View File

@ -123,7 +123,19 @@
/* collapsing sidebar */ /* collapsing sidebar */
.toggle-sidebar-button {
position: absolute;
top: -10px;
left: 0;
z-index: 100;
margin: 10px;
height: 22px;
width: 22px;
padding-left: 2px;
padding-top: 0px;
}
.sidebar-wrapper { .sidebar-wrapper {
position: relative;
width: 275px; width: 275px;
transition: width 0.5s ease; transition: width 0.5s ease;
overflow-x: hidden; overflow-x: hidden;

View File

@ -1,7 +1,10 @@
<h2>Login</h2> <div class="card text-center w-50 mx-auto">
<div class="login-form"> <h2 class="card-header">Login</h2>
<div class="card-body">
<p class="card-text"><strong>Welcome to JILO!</strong><br />Please enter login credentials:</p>
<form method="POST" action="?page=login"> <form method="POST" action="?page=login">
<input type="text" name="username" placeholder="Username" required /> <input type="text" name="username" placeholder="Username" required />
<br /> <br />
@ -11,7 +14,9 @@
<input type="checkbox" id="remember_me" name="remember_me" /> <input type="checkbox" id="remember_me" name="remember_me" />
remember me remember me
</label> </label>
<br /> <br />&nbsp;<br />
<input type="submit" value="Login" /> <input type="submit" class="btn btn-primary" value="Login" />
</form> </form>
</div> </div>
</div>

View File

@ -1,12 +1,17 @@
<h2>Register</h2> <div class="card text-center w-50 mx-auto">
<div class="register-form"> <h2 class="card-header">Register</h2>
<div class="card-body">
<p class="card-text">Enter credentials for registration:</p>
<form method="POST" action="?page=register"> <form method="POST" action="?page=register">
<input type="text" name="username" placeholder="Username" required /> <input type="text" name="username" placeholder="Username" required />
<br /> <br />
<input type="password" name="password" placeholder="Password" required /> <input type="password" name="password" placeholder="Password" required />
<br /> <br />&nbsp;<br />
<input type="submit" value="Register" /> <input type="submit" class="btn btn-primary" value="Register" />
</form> </form>
</div> </div>
</div>

View File

@ -5,11 +5,9 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<a href="index.php" class="logo-link"><div class="col-4"><img class="logo" src="static/jilo-logo.png" alt="JILO"/></div></a> <a href="index.php" class="logo-link"><div class="col-4"><img class="logo" src="static/jilo-logo.png" alt="JILO"/></div></a>
<div class="col-4"><button class="btn btn-sm btn-info" style="position: absolute; top: 55px; left: 11px; z-index: 100;" type="button" id="toggleSidebarButton" value=">>"></button></div>
</div> </div>
</div> </div>
<!--li><a href="index.php">home</a></li-->
<?php if ( isset($_SESSION['username']) ) { ?> <?php if ( isset($_SESSION['username']) ) { ?>
<li><a href="?page=config">config</a></li> <li><a href="?page=config">config</a></li>
<li><a href="?page=conferences">conferences</a></li> <li><a href="?page=conferences">conferences</a></li>

View File

@ -5,11 +5,13 @@
<!--button class="btn btn-secondary" type="button" id="toggleSidebarButton"> <!--button class="btn btn-secondary" type="button" id="toggleSidebarButton">
sidebar sidebar
</button--> </button-->
<div class="col-4"><button class="btn btn-sm btn-info toggle-sidebar-button" type="button" id="toggleSidebarButton" value=">>"></button></div>
<div class="sidebar-content card ml-3 mt-3"> <div class="sidebar-content card ml-3 mt-3">
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
<li class="list-group-item"><a href="#">stats</a></li> <li class="list-group-item"><a href="#">stats</a></li>
<li class="list-group-item"><a href="#">config</a></li> <li class="list-group-item"><a href="#">config</a></li>
<li class="list-group-item"><a href="#">logs</a></li> <li class="list-group-item"><a href="?page=logs">logs</a></li>
</ul> </ul>
</div> </div>
</div> </div>