-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
160 lines (140 loc) · 5.54 KB
/
admin.php
File metadata and controls
160 lines (140 loc) · 5.54 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
session_start();
// Ensure the user is logged in and has the 'Admin' role
if (!isset($_SESSION['user']) || $_SESSION['user']['role'] != 'Admin') {
echo "<script>alert('You are not authorized to access this page.'); window.location.href = 'loging.php';</script>";
exit();
}
$user = $_SESSION['user'];
// Ensure the 'dateCreated' field is set and not null before using DateTime
$dateCreated = isset($user['dateCreated']) ? $user['dateCreated'] : ''; // Default date if null
// If dateCreated is not empty, format it using DateTime
if (!empty($dateCreated)) {
// Remove milliseconds if they exist (optional based on your DB format)
$dateCreated = preg_replace('/\.\d{3}$/', '', $dateCreated); // Removes the milliseconds part
// Now create the DateTime object
$date = new DateTime($dateCreated);
$formattedDate = $date->format('F j, Y, g:i a'); // Example: March 4, 2025, 4:12 pm
} else {
$formattedDate = 'Unknown Date';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<style>
body {
background-image: url('http://localhost/All_FOR_MUSIC/Logo/logo.jpeg');
background-size: cover;
background-position: center;
background-attachment: fixed;
backdrop-filter: blur(8px);
height: 100vh;
}
.navbar-custom {
background-color: #000;
}
.navbar-custom a {
color: gold;
}
.profile-pic {
width: 150px;
height: 150px;
border-radius: 50%;
object-fit: cover;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}
.card-body {
background-color: rgba(0, 0, 0, 0.7);
color: white;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}
.navbar-custom a:hover {
color: #f39c12;
}
.card {
background-color: rgba(0, 0, 0, 0.7);
border-radius: 15px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}
.list-group-item {
background-color: #333;
color: gold;
border: none;
transition: background-color 0.3s ease;
}
.list-group-item:hover {
background-color: #f39c12;
color: #333;
}
.container {
margin-top: 50px;
z-index: 2;
}
.navbar-brand {
color: gold;
font-weight: bold;
font-size: 1.5rem;
}
.navbar-toggler-icon {
background-color: gold;
}
</style>
</head>
<body>
<!-- Navigation Bar -->
<nav class="navbar navbar-expand-lg navbar-custom">
<a class="navbar-brand" href="#">All For Music Admin</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="admin.php">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
</ul>
</div>
</nav>
<div class="container mt-5">
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-body text-center">
<img src="<?= $user['profilePicture'] ?>" alt="Profile Picture" class="profile-pic mb-3">
<h3><?= $user['username'] ?></h3>
<p><?= $user['email'] ?></p>
<p>Role: <?= $user['role'] ?></p>
</div>
</div>
</div>
<div class="col-md-8">
<!-- Admin Options Panel -->
<div class="list-group">
<a href="Register.php?role=Admin" class="list-group-item list-group-item-action">Add Users</a>
<a href="Add_learningPackages.php" class="list-group-item list-group-item-action">Add Learning Packages</a>
<a href="viewuser.php" class="list-group-item list-group-item-action">View Users</a>
<a href="UserSearch&Update.php" class="list-group-item list-group-item-action">Update Users</a>
<a href="ViewLearningPackages.php" class="list-group-item list-group-item-action">View Learning Packages</a>
<a href="Instrument.php" class="list-group-item list-group-item-action">Add instrumnet</a>
<a href="InstrumentUpdate.php" class="list-group-item list-group-item-action">Update instrumnet</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap JS and jQuery -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</body>
</html>