-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadministrators.php
137 lines (111 loc) · 4.64 KB
/
administrators.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
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
<?php include('partials/headerSection.php');
error_reporting(0);
ob_start();
?>
<div class="main">
<?php include('partials/sideMenu.php')?>
<div class="mainContent">
<div class="topSection flex">
<div class="dashboardTitle">
<h1>Administrators Page</h1>
</div>
<div class="userBox flex">
<a href="index.php">
<div class="adminImage">
<img src="./assets/images/pp.jpg" alt="Admin Image">
</div>
</a>
<div class="userName">
<span>Administrator</span>
<small><?php
if(isset($_SESSION['firstName'])){
echo $_SESSION['firstName'];
}
?></small>
</div>
<i class="uil uil-bell icon"></i>
</div>
</div>
<div class="body">
<div class="overViewDiv">
<div class="intro flex" >
<h3 class="title">Administrators</h3>
<?php
if(isset($_SESSION['adminAdded'])){
echo $_SESSION['adminAdded'];
unset ($_SESSION['adminAdded']);
}
if(isset($_SESSION['admins'])){
echo $_SESSION['admins'];
unset ($_SESSION['admins']);
}
if(isset($_SESSION['deleteAdmin'])){
echo $_SESSION['deleteAdmin'];
unset ($_SESSION['deleteAdmin']);
}
if(isset($_SESSION['updateAdmin'])){
echo $_SESSION['updateAdmin'];
unset ($_SESSION['updateAdmin']);
}
?>
<div class="addBtn">
<a href="addAdmin.php">
<span>Add Admin</span>
</a>
</div>
</div>
</div>
<div class="mainItems">
<table>
<tr class="tableHeader">
<th>Databse ID</th>
<th>First Name</th>
<th>Second Name</th>
<th>ATP ID</th>
<th>Roles</th>
<th>Password</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<?php
$sql = "SELECT * FROM admins";
$result = mysqli_query($conn, $sql);
if($result == TRUE){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)){
$dbID = $row['id'];
$firstName = $row['first_name'];
$secName = $row['second_name'];
$atpId = $row['atp_id'];
$admin_role = $row['admin_role'];
$admin_password = $row['admin_pswrd'];
?>
<tr class="tableData">
<td><?php echo $dbID;?></td>
<td><?php echo $firstName;?></td>
<td><?php echo $secName;?></td>
<td><?php echo $atpId;?></td>
<td><?php echo $admin_role;?></td>
<td><?php echo $admin_password;?></td>
<td><a href="<?php echo SITEURL ?>updateAdmin.php?id=<?php echo $dbID; ?>"><i class="uil uil-edit icon editIcon"></i></a></td>
<td> <a href="<?php echo SITEURL ?>deleteAdmin.php?id= <?php echo $dbID;?>"><i class="uil uil-times-square icon deleteIcon"></i></a></td>
</tr>
<?php
}
}
else{
$_SESSION['admins'] = '<span class="fail"> No single amdministrator!</span>';
header('location:' . SITEURL. 'administrators.php');
exit();
}
}
else{
die('Connection Failed');
}
?>
</table>
</div>
</div>
</div>
</div>
<?php include('partials/footer.php')?>