start.php succeeds secure.php

This commit is contained in:
thies 2021-01-10 19:13:06 +01:00
parent c7876824d2
commit 8813cb8c54
3 changed files with 21 additions and 54 deletions

View File

@ -1,48 +0,0 @@
<html>
<head>
<title>Secure Area</title>
<link rel="stylesheet" href="ressources/css/bootstrap.min.css" crossorigin="anonymous">
</head>
<body>
<script src="ressources/js/bootstrap.min.js"></script>
<?php
session_start();
if(!isset($_SESSION['userid'])) {
die('Please <a href="login.php">login</a>');
}
$username = $_SESSION['username'];
$activated = $_SESSION['activated'];
$isadmin = $_SESSION['isadmin'];
echo "Hi ".$username."!";
if(isset($_GET['activation_req'])) {
echo '<div class="alert alert-danger" role="alert">Your account isnt activated yet!</div><br>';
}
?>
<br><br>
<a href="profile.php"><button class="btn btn-primary">Profile</button></a>
<br><br>
<?php
if ($activated == 0) {
echo '<a href="?activation_req=1"><button class="btn btn-primary disabled">Activated Area</button></a>';
}
if ($activated == 1) {
echo '<a href="activatedarea.php"><button class="btn btn-primary">Activated Area</button></a>';
}
?>
<br><br>
<a href="logout.php"><button class="btn btn-danger">LOGOUT</button></a>
<br><br><br>
<?php
if ($isadmin == 0) {
echo '<br>';
}
if ($isadmin == 1) {
echo '<a href="adminarea.php"><button class="btn btn-danger">Admin Area</button></a>';
}
?>
</body>
</html>

View File

@ -1,6 +1,8 @@
<?php <?php
session_start(); session_start();
$userid = $_SESSION['userid']; $userid = $_SESSION['userid'];
$isadmin = $_SESSION['isadmin'];
$activated = $_SESSION['activated'];
?> ?>
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
@ -41,7 +43,10 @@ $userid = $_SESSION['userid'];
} }
?> ?>
</div> </div>
<?php
if(isset($_GET['activation_req'])) {
echo '<div class="alert alert-danger" role="alert">Your account isnt activated yet!</div><br>';
}?>
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center"> <div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">loginpagefoo POC (PHP & MySQL)</h1> <h1 class="display-4">loginpagefoo POC (PHP & MySQL)</h1>
<p class="lead">Just a crappy POC written in PHP using PHP, HTML & MySQL.</p> <p class="lead">Just a crappy POC written in PHP using PHP, HTML & MySQL.</p>
@ -91,7 +96,13 @@ $userid = $_SESSION['userid'];
<ul class="list-unstyled mt-3 mb-4"> <ul class="list-unstyled mt-3 mb-4">
<li>Show the Activated Area</li> <li>Show the Activated Area</li>
</ul> </ul>
<a href="activatedarea.php"><button type="button" class="btn btn-lg btn-block btn-primary">Activated Area</button></a> <?php
if ($activated == 0) {
echo '<a href="?activation_req=1"><button class="btn btn-primary disabled">Activated Area</button></a>';
}
if ($activated == 1) {
echo '<a href="activatedarea.php"><button class="btn btn-lg btn-block btn-primary">Activated Area</button></a>';
}?>
</div> </div>
</div> </div>
<?php <?php
@ -144,7 +155,14 @@ $userid = $_SESSION['userid'];
<?php <?php
} }
?> ?>
<?php
if ($isadmin == 0) {
echo '<br>';
}
if ($isadmin == 1) {
echo '<a href="adminarea.php"><button class="btn btn-danger">Admin Area</button></a>';
}
?>
<footer class="pt-4 my-md-5 pt-md-5 border-top"> <footer class="pt-4 my-md-5 pt-md-5 border-top">
<div class="row"> <div class="row">
<div class="col-12 col-md"> <div class="col-12 col-md">

View File

@ -1,3 +0,0 @@
<?php
?>