-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin_sidebar.php
79 lines (76 loc) · 2.97 KB
/
admin_sidebar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE HTML>
<html>
<head>
<?php
session_start();
include "connect.php";
if (!isset($_SESSION['key'])) {
header("Location: ./login.php");
} else {
$username = pg_escape_string($connection, $_SESSION['key']);
$query = "SELECT full_name, role FROM account where username='" . $username . "'";
$result = pg_query($connection, $query) or die('Query unsuccessful:' . pg_last_error());
$details = pg_fetch_assoc($result);
// ensure current user is admin
if ($details['role']!='admin') {
header("Location: ./user_home.php");
}
}
?>
<div class="col-sm-12 col-md-4 col-lg-3 page-sidebar">
<aside>
<div class="sidebar-box">
<div class="user">
<figure>
<a href="./user_home.php"><img src="./assets/img/avatar.png" alt=""></a>
</figure>
<div class="usercontent">
<h3 style="text-transform: none"><?php echo $details['full_name']?></h3>
<h4 style="text-transform: capitalize"><?php echo $details['role']?></h4>
</div>
</div>
<nav class="navdashboard">
<ul>
<li>
<a href="./admin_dashboard.php">
<i class="lni-dashboard"></i>
<span>Dashboard</span>
</a>
</li>
<li>
<a href="./admin_panel.php">
<i class="lni-cog"></i>
<span>Profile Settings</span>
</a>
</li>
<li>
<a href="./view_users.php">
<i class="lni-users"></i>
<span>View All Users</span>
</a>
</li>
<li>
<a href="./view_items.php">
<i class="lni-layers"></i>
<span>View All Items</span>
</a>
</li>
<li>
</li>
<li>
<a href="./view_bids.php">
<i class="lni-envelope"></i>
<span>View All Bids</span>
</a>
</li>
<li>
<a href="./logout.php">
<i class="lni-enter"></i>
<span>Logout</span>
</a>
</li>
</ul>
</nav>
</div>
</aside>
</div>