bug fixes.

This commit is contained in:
Joshua Ashton
2025-02-07 14:58:10 -07:00
parent d971025a81
commit 06f7540b26
+15 -16
View File
@@ -9,7 +9,6 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
if (array_key_exists($username, $users) && $users[$username] === $password) {
$_GET['error'] = false;
$_SESSION['access'] = true;
$_GET['file'] = 'includes/fbi.txt';
} else {
@@ -35,15 +34,17 @@ if (isset($_GET['logout'])) {
<body>
<h1>View Confidential Information</h1>
<?php if (isset($_SESSION['access']) && $_SESSION['access'] !== true): ?>
<?php if (isset($_GET['error']) && $_GET['error'] === true): ?>
<div class="card error">
<?php
if ($_SESSION['access'] !== true) {
if (isset($_GET['error']) && $_GET['error'] === true) {
echo '
<div class="card error">
<h5 class="error">Access Denied.</h5>
</div>
<?php endif; ?>
<form method="post">
</div>
';
}
echo '
<form method="post">
<div class="row">
<input name="username" type="text" placeholder="username">
<input name="password" type="password" placeholder="password">
@@ -52,9 +53,10 @@ if (isset($_GET['logout'])) {
<button>Submit</button>
<button type="reset" class="reset">Reset</button>
</div>
</form>
<?php else: ?>
</form>
';
} else if (isset($_GET['file']) && isset($_SESSION['access'])) {
echo '
<div class="card success">
<h5 class="success">Access Granted.</h5>
</div>
@@ -65,10 +67,7 @@ if (isset($_GET['logout'])) {
<button name="logout" value="true" class="reset">Logout</button>
</div>
</form>
<?php endif; ?>
<?php
if (isset($_GET['file']) && isset($_SESSION['access'])) {
';
fileRead($_GET['file']);
}
?>