-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreports.php
356 lines (331 loc) · 10 KB
/
reports.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>ATI Kegalle - Admin Panel</title>
<!-- Font Awesome -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
rel="stylesheet"
/>
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
rel="stylesheet"
/>
<!-- MDB -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.5.0/mdb.min.css"
rel="stylesheet"
/>
</head>
<body>
<?php
session_start();
if ( isset( $_SESSION[ "admin" ] ) && $_SESSION[ "admin" ] != "" ) {
require 'conn.php';
$sql = "SELECT `AdUName` FROM `admin` WHERE `AdUName` ='" . $_SESSION[ "admin" ] . "';";
$result = mysqli_query( $conn, $sql );
if ( mysqli_num_rows( $result ) > 0 ) {
$row = mysqli_fetch_assoc( $result );
$uname = $row[ 'AdUName' ];
} else {
header( "location:admin-login.php?status=fail" );
}
} else {
header( "location:admin-login.php" );
exit;
}
?>
<!-- Navbar -->
<nav
class="navbar navbar-expand-lg navbar-dark mb-3"
style="background-color: #03045e"
>
<!-- Container wrapper -->
<div class="container-fluid">
<!-- Navbar brand -->
<a class="navbar-brand" href="index.html"
><img src="assets/logo.png" width="30" height="30" alt=""
/></a>
<!-- Toggle button -->
<button
class="navbar-toggler"
type="button"
data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<i class="fas fa-bars"></i>
</button>
<!-- Collapsible wrapper -->
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<!-- Link -->
<li class="nav-item">
<a class="nav-link" href="announcement.html">Announcements</a>
</li>
<li class="nav-item">
<a class="nav-link" href="gallery.html">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="member-enter.html"
><text style="color: aqua"><strong>Enter ATI</strong> </text></a
>
</li>
<!-- Login Dropdown -->
<li class="nav-item dropdown">
<a
class="nav-link dropdown-toggle"
href="#"
id="navbarDropdown"
role="button"
data-mdb-toggle="dropdown"
aria-expanded="false"
>
<i class="fa fa-fw fa-user"></i>
</a>
<!-- Dropdown menu -->
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>
<a class="dropdown-item" href="profile.html">Your Profile</a>
</li>
<li>
<a class="dropdown-item" href="register.html">Register</a>
</li>
<li>
<a class="dropdown-item" href="login.html">Login</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- Container wrapper -->
</nav>
<!-- Navbar -->
<!--Content-->
<div class="container">
<script>
function filter(obj,row) {
// Declare variables
var input, filter, table, tr, td, i, txtValue;
//input = document.getElementById("myInput");
input = document.getElementById(obj);
filter = input.value.toUpperCase();
table = document.getElementById("member");
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")[row];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
<!-- Search Section -->
<div class="row mb-4">
<div class="col">
<div class="input-group mb-3">
<input
type="date"
class="form-control"
placeholder="First Date"
aria-label="First Date"
aria-describedby="button-addon2"
/>
</div>
</div>
<div class="col">
<div class="input-group mb-3">
<input
type="date"
class="form-control"
placeholder="Last Date"
aria-label="Last Date"
aria-describedby="button-addon2"
/>
<button
class="btn btn-outline-primary"
type="button"
id="button-addon2"
data-mdb-ripple-color="dark"
>
<i class="fas fa-search"></i>
</button>
</div>
</div>
<div class="col">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Name or NIC" aria-label="Name or NIC" aria-describedby="button-addon2" id="name" onKeyUp="filter('name',0)" />
</div>
</div>
<div class="col">
<div class="input-group mb-3">
<input
type="text"
class="form-control"
placeholder="Department"
aria-label="Department"
aria-describedby="button-addon2"
id="dep"
onKeyUp="filter('dep',3)"
/>
</div>
</div>
<div class="col">
<div class="input-group mb-3">
<input
type="text"
class="form-control"
placeholder="Designation"
aria-label="Designation"
aria-describedby="button-addon2"
id="des"
onKeyUp="filter('des',4)"
/>
</div>
</div>
</div>
</div>
<!--Tables-->
<div>
<h5 class="text-center">Members</h5>
<table class="table mb-5" id="member">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Date of Birth</th>
<th scope="col">Address</th>
<th scope="col">Department</th>
<th scope="col">Designation</th>
<th scope="col">Age</th>
<th scope="col">NIC</th>
<th scope="col">Gender</th>
<th scope="col">Mobile</th>
<th scope="col">Date</th>
<th scope="col">Time In</th>
<th scope="col">Time Out</th>
</tr>
</thead>
<tbody>
<?php
require 'conn.php';
$sql = "SELECT `member`.`MemName` AS `Name` , `member`.`MemDOB` AS `Date of Birth` , `member`.`MemAddress` AS `Address` , `member`.`MemDept` AS `Department` , `member`.`MemDesig` AS `Designation` , TIMESTAMPDIFF(YEAR, `MemDOB`, CURDATE()) AS `Age` , `member`.`MemNIC` AS `NIC` , `member`.`MemGender` AS `Gender` , `member`.`MemMobile` AS `Mobile` , `member_log`.`Date` , `member_log`.`TimeIn` , `member_log`.`TimeOut` FROM `tkdb`.`member_log` INNER JOIN `tkdb`.`member` ON (`member_log`.`MemUName` = `member`.`MemUName`)";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td scope='row'>". $row["Name"]."</td>
<td>". $row["Date of Birth"]."</td>
<td>". $row["Address"]."</td>
<td>". $row["Department"]."</td>
<td>". $row["Designation"]."</td>
<td>". $row["Age"]."</td>
<td>". $row["NIC"]."</td>
<td>". $row["Gender"]."</td>
<td>". $row["Mobile"]."</td>
<td>". $row["Date"]."</td>
<td>". $row["TimeIn"]."</td>
<td>". $row["TimeOut"]."</td>
</tr>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</tbody>
</table>
</div>
<h5 class="text-center">Visitors</h5>
<table class="table mb3" id="visitor">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">NIC</th>
<th scope="col">Date of Birth</th>
<th scope="col">Age</th>
<th scope="col">Address</th>
<th scope="col">Gender</th>
<th scope="col">Phone</th>
<th scope="col">Reason</th>
<th scope="col">Date</th>
<th scope="col">Time In</th>
<th scope="col">Time Out</th>
</tr>
</thead>
<tbody>
<?php
require 'conn.php';
$sql = "SELECT `visitor`.`ViName` AS `Name` , `visitor`.`ViNIC` AS `NIC` , `visitor`.`ViDob` AS `Date of Birth` , TIMESTAMPDIFF(YEAR, `ViDob`, CURDATE()) AS `Age` , `visitor`.`ViAddress` AS `Address` , `visitor`.`ViGender` AS `Gender` , `visitor`.`ViMobile` AS `Phone` , `visitor`.`ViReason` AS `Reason` , `visitor_log`.`Date` , `visitor_log`.`TimeIn` , `visitor_log`.`TimeOut` FROM `tkdb`.`visitor_log` INNER JOIN `tkdb`.`visitor` ON (`visitor_log`.`ViNIC` = `visitor`.`ViNIC`);";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td scope='row'>". $row["Name"]."</td>
<td>". $row["NIC"]."</td>
<td>". $row["Date of Birth"]."</td>
<td>". $row["Age"]."</td>
<td>". $row["Address"]."</td>
<td>". $row["Gender"]."</td>
<td>". $row["Phone"]."</td>
<td>". $row["Reason"]."</td>
<td>". $row["Date"]."</td>
<td>". $row["TimeIn"]."</td>
<td>". $row["TimeOut"]."</td>
</tr>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</tbody>
</table>
<div class="text-center mb-5">
<form method="post" action="reports.php">
<button type="submit" class="btn btn-danger" name="logout">Log out</button>
<a href="admin-edit.php"><button type="button" class="btn btn-primary">Edit Content</button></a>
</form>
<?php
if ( isset( $_POST[ 'logout' ] ) ) {
unset( $_SESSION );
session_destroy();
echo "<script> location.href='admin-login.php'; </script>";
}
?>
</div>
<!--Content-->
<!-- Footer -->
<footer class="footer text-center text-white fixed-bottom">
<div
class="text-center p-0"
style="background-color: rgba(0, 0, 0, 0.774)"
>
Made with ❤️ by HNDIT 2019 batch.
</div>
</footer>
<!-- MDB -->
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.5.0/mdb.min.js"
></script>
</body>
</html>