implementing admin pages
This commit is contained in:
parent
96c8bd638b
commit
b30b8a1f5b
@ -11,5 +11,13 @@ session_start();
|
|||||||
if($_SESSION['isadmin'] == 0) {
|
if($_SESSION['isadmin'] == 0) {
|
||||||
die ('No rights for you! <meta http-equiv="refresh" content="0; URL=logout.php">');
|
die ('No rights for you! <meta http-equiv="refresh" content="0; URL=logout.php">');
|
||||||
}
|
}
|
||||||
echo "heres the admin world";
|
echo '<div class="alert alert-danger" role="alert">heres the admin world</div>';
|
||||||
|
|
||||||
|
echo '<a href="adminarea_useradmin.php"><button class="btn btn-primary">User Admin</button></a>';
|
||||||
|
echo '<br /> <br />';
|
||||||
|
echo '<a href="adminarea_sessions.php"><button class="btn btn-primary">Session Admin</button></a>';
|
||||||
|
echo '<br /> <br />';
|
||||||
|
echo '<a href="adminarea_admins.php"><button class="btn btn-danger">Admin Admin</button></a>';
|
||||||
|
echo '<br /> <br />';
|
||||||
|
echo '<a href="secure.php"><button class="btn btn-info">Back</button></a>';
|
||||||
?>
|
?>
|
35
adminarea_useradmin.php
Normal file
35
adminarea_useradmin.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Admin 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();
|
||||||
|
include 'db.inc.php';
|
||||||
|
$username = $_SESSION['username'];
|
||||||
|
|
||||||
|
$statement = $pdo->prepare("SELECT * FROM users WHERE username = :username");
|
||||||
|
$result = $statement->execute(array('username' => $username));
|
||||||
|
$user = $statement->fetch();
|
||||||
|
$_SESSION['userid'] = $user['id'];
|
||||||
|
$_SESSION['email'] = $user['email'];
|
||||||
|
$_SESSION['username'] = $user['username'];
|
||||||
|
$_SESSION['givenName'] = $user['givenName'];
|
||||||
|
$_SESSION['lastName'] = $user['lastName'];
|
||||||
|
$_SESSION['activated'] = $user['activated'];
|
||||||
|
$_SESSION['updated_at'] = $user['updated_at'];
|
||||||
|
$_SESSION['isadmin'] = $user['isadmin'];
|
||||||
|
|
||||||
|
if($_SESSION['isadmin'] == 0) {
|
||||||
|
die ('No rights for you! <meta http-equiv="refresh" content="0; URL=logout.php">');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<div class="alert alert-danger" role="alert">heres the admin world</div>';
|
||||||
|
|
||||||
|
|
||||||
|
echo '<br /> <br />';
|
||||||
|
echo '<a href="adminarea.php"><button class="btn btn-info">Back</button></a>';
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user