-
Notifications
You must be signed in to change notification settings - Fork 0
/
logs.php
68 lines (65 loc) · 2.72 KB
/
logs.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
<?php
$url = PageURL();
include("includes/check_login.php"); //Check if user is logged in
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Troopr - Logs</title>
<?php include("includes/meta.php") ?>
</head>
<body>
<div class="container">
<?php
include("includes/header.php"); //include header div
include("includes/nav.php"); //include nav div
include("includes/sidebar.php"); //include sidebar
function PageURL() {
$pageURL = 'http';
//if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
include("includes/db_connect.php");
if($_GET['action'] == "activity"){
$result = mysql_query("SELECT * FROM activity_logs ORDER BY datetime DESC");
$field = "action";
$heading = "Action";
}
else if($_GET['action'] == "access"){
$result = mysql_query("SELECT * FROM access_logs ORDER BY datetime DESC");
$field = "type";
$heading = "Type";
}
?>
<div class="content">
<h2>Logs</h2>
<div class="submenu">
<img src="images/icons/page_white_gear.png" alt="page gear" /> <a href="logs.php?action=activity">Activity Logs</a> |
<img src="images/icons/page_white_key.png" alt="page key" /> <a href="logs.php?action=access">Access Logs</a>
</div>
<table>
<tr>
<th>Username</th>
<th>Action</th>
<th>Date/Time</th>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
echo '<tr><td>'.$row['username'].'</td><td>'.$row[''.$field.''].'</td><td>'.$row['datetime'].'</td>';
echo '</tr>';
}
mysql_close($conn);
?>
</table>
</div>
</div>
</body>
</html>