-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuser-management.php
281 lines (268 loc) · 13.9 KB
/
user-management.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?php
session_start();
if(!isset($_SESSION['idNo'])){
header("location: authenticate.html#login");
}
if($_SESSION['uType']!="1"){
header("location: user-dashboard.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>User Management</title>
<link rel="icon" type="image/png" href="./images/blue-coin.png">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="css/materialize.css" media="screen,projection"/>
<link rel="stylesheet" type="text/css" media="screen" href="./css/style.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
<nav>
<div class="nav-wrapper top-nav">
<a href="#" data-target="slide-out" class="sidenav-trigger hide-on-small-only show-on-medium-and-up"><i class="material-icons">menu</i></a>
<div class="img-hold" style="margin-top: 5px;">
<a href="admin-dash.php" class="brand-logo"><img src="./images/p2p-logo-white-resize.png"></a>
</div>
<!--Menu Trigger on Small Screen-->
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-small-only">
<li><a class="dropdown-trigger user-name" href="#" data-target="dropdown1"><?php echo $_SESSION['FName'][0];?><i class="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
<!--Username DropDown Items-->
<ul id="dropdown1" class="dropdown-content">
<li><a href="admin-profile.php">My Profile<i class="material-icons left">account_circle</i></a></li>
<li><a href="./admin-settings.php">Settings<i class="material-icons left">settings</i></a></li>
<li class="divider"></li>
<li><a href="./logout.php">Logout<i class="material-icons left">power_settings_new</i></a></li>
</ul>
<!--NavBar Resize Menu-->
<ul class="sidenav" id="mobile-demo">
<li><a href="./admin-dash.php">Back to Dashboard Home<i class="material-icons">keyboard_backspace</i></a></li>
<li><a href="./user-management.php">User Management<i class="material-icons left">supervised_user_circle</i></a></li>
<li><a href="./transaction-mgmt.php">Transaction Management<i class="fas fa-money-bill left"></i></a></li>
<li><a href="./user-messages.php">User Feedback<i class="material-icons left">feedback</i></a></li>
<li><a href="./admin-settings.php">Manage Settings<i class="material-icons left">settings</i></a></li>
<li><a href="./logout.php">Logout<i class="material-icons left">power_settings_new</i></a></li>
</ul>
<!-- </div> -->
<!--Admin Side Menu Fixed-->
<ul id="slide-out" class="sidenav">
<li><a class="sidenav-close" href="#!">✕</a></li>
<li><div class="user-view">
<!-- <div class="background">
<img src="images/office.jpg">
</div> -->
<a href="admin-settings.php"><img class="circle" src="images/default-user-icon.png"></a>
<a href="admin-profile.php"><span class="white-text name"><?php echo $_SESSION['FName'][0];?></span></a>
<a href="admin-settings.php"><span class="subheader white-text email"><?php echo $_SESSION['email']?></span></a>
</div></li>
<li><a href="./admin-dash.php">Back to Dashboard Home<i class="material-icons">keyboard_backspace</i></a></li>
<li><a href="./user-management.php"><i class="material-icons">supervised_user_circle</i>User Management</a></li>
<li><a href="./transaction-mgmt.php"><i class="fas fa-money-bill"></i>Transaction Management</a></li>
<li><a href="./user-messages.php"><i class="material-icons">feedback</i>User Feedback</a></li>
<li><div class="divider"></div></li>
<li><a href="./admin-settings.php"><i class="material-icons">settings</i>Manage Settings</a></li>
<li><a class="waves-effect" href="./logout.php"><i class="material-icons">power_settings_new</i>Logout</a></li>
</ul>
<!-- <main> -->
<div class="dashboard-title">
<h6 class="left-align">Manage Borrowers</h6>
</div>
<div class="row">
<div class="col s12 m12 l12">
<div style="padding: 20px; text-align: center" class="card" id="card-row">
<div class="row">
<div class="left card-title">
<b class="white-text">Borrowers' Table</b>
</div>
</div>
<div class="row">
<div style="padding:20px;"class="col s12 m12 l12">
<div class="container">
<form>
<input class="searchForm" onkeyup="Search()" id="search" placeholder="Search by ID Number...">
<button type="submit" class="searchButton"><i class="fa fa-search"></i></button>
</form>
</div>
</div>
</div>
<div class="row">
<div style="padding:20px;" class="grey lighten-3 col s12 m12 l12">
<div class="center-align container" id="borrowers-table">
<table class="responsive-table" id="table">
<thead>
<tr>
<th>ID Number</th>
<th>Name</th>
<th>Amount Borrowed</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
require_once 'connect-db.php';
$sql = "SELECT User_ID,BorrowerName,LoanAmount from liveborrower";
$query = $con->query($sql);
if ($query->num_rows>0)
{
// output data of each row
while($row = $query->fetch_array())
{
echo "<tr><td>". $row["User_ID"]. "</td><td>". $row["BorrowerName"]. "</td><td>". $row["LoanAmount"]. "</td><td style=float: left;><a href='#confirm' onclick=$('#confirm').modal('open') title='Disable User Account'><i class='material-icons'>close</i></a></td></tr>";
}
}
else
{
echo "0 result";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="dashboard-title">
<h6 class="left-align">Manage Lenders</h6>
</div>
<div class="row">
<div class="col s12 m12 l12">
<div style="padding:20px; text-align: center" class="card" id="card-row">
<div class="row">
<div class="left card-title">
<b class="white-text">
Lenders' Table
</b>
</div>
</div>
<div class="row">
<div style="padding:20px;"class="col s12 m12 l12">
<div class="container">
<form>
<input class="searchForm" onkeyup="search()" id="Search" placeholder="Search by ID Number...">
<button type="submit" class="searchButton"><i class="fa fa-search"></i></button>
</form>
</div>
</div>
</div>
<div class="row">
<div style="padding:20px;" class="grey lighten-3 col s12 m12 l12">
<div class="center-align container" id="lenders-table">
<table class=" responsive-table" id="table1">
<thead>
<tr>
<th>ID number</th>
<th>Name</th>
<th>Amount Loaned Out</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
require_once 'connect-db.php';
$sql = "SELECT users.ID_Number, users.Username, loans.Amount, loans.LenderID
FROM users
INNER JOIN loans ON users.ID_Number=loans.LenderID;";
$query = $con->query($sql);
if ($query->num_rows>0)
{
// output data of each row
while($row = $query->fetch_array())
{
echo "<tr><td>". $row["ID_Number"]. "</td><td>". $row["Username"]. "</td><td>". $row["Amount"]. "</td><td style=float: left;><a href='#confirm' onclick=$('#confirm').modal('open') title='Disable User Account'><i class='material-icons'>close</i></a></td></tr>";
}
}
else
{
echo "0 result";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="black lighten-2 page-footer" style="text-align:center; padding: 10px;">
<div class=" center-align container">
© 2018 StrathFund
</div>
</footer>
<script type="text/javascript" src="js/materialize.js"></script>
<script src="./js/index.js"></script>
<!-- confirm Modal -->
<div class="modal" id="confirm">
<div class="modal-content">
<div class="row">
<div class="col s8 m8 l8" id="report-container">
<span class="report-modal-header" style="color:teal;"><h5>Are you sure you want to disable this account?</h5></span>
</div>
<div class="col s4 m4 l4">
<a href="#!" class="modal-close waves-effect waves-green right"><i class="material-icons center">close</i></a>
</div> <br><br>
<a href="user-disable.php" class="waves-effect waves-dark btn-small left" name="delete">Disable</a>
<a href="#" style="margin-left:20px;" class="waves-effect waves-light btn-small left">Cancel</a>
</div>
</div>
<script>
function Search(){
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("search");
filter = input.value.toUpperCase();
table = document.getElementById("table");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td)
{
if (td.innerHTML.toUpperCase().indexOf(filter) > -1)
{
tr[i].style.display = "";
}
else
{
tr[i].style.display = "none";
}
}
}
}
function search(){
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("Search");
filter = input.value.toUpperCase();
table = document.getElementById("table1");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td)
{
if (td.innerHTML.toUpperCase().indexOf(filter) > -1)
{
tr[i].style.display = "";
}
else
{
tr[i].style.display = "none";
}
}
}
}
</script>
</body>
</html>