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