forked from gaza1994/SHOUTcast-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventviewer.php
89 lines (88 loc) · 2.64 KB
/
eventviewer.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
<?php
/*
* @author: Scottish Borders Design
* @script: SBD SHOUTcast Manager
* @function: Events Viewer
* @website: http://scottishbordersdesign.co.uk/
*/
header('Access-Control-Allow-Origin: *');
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if(useraccess($_SESSION['username']) < "4"){
echo "ACCESS DENIED - INCIDENT REPORTED";
$event = " Attempted to access the restricted user management section.";
addevent($_SESSION['username'], $event);
} else {
?>
<div class="box">
<div class="box-header">
<h3 class="box-title">Event Log</h3>
</div><!-- /.box-header -->
<div class="box-body table-responsive">
<table class="table table-bordered table-striped" id="EVENTLOG">
<thead>
<tr>
<th>#</th>
<th>Timestamp</th>
<th>Events</th>
<th>IP</th>
</tr>
</thead>
<tbody>
<?php
$i = "0";
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
};
////////////////////////////////////////////////////////////
//
// If user is not a mod or higher only show them their own
// events.
//
////////////////////////////////////////////////////////////
if(useraccess($_SESSION['username']) < "4"){
$db->orderBy('id', 'DESC');
$db->where('event_user', $_SESSION['username']);
$db->pageLimit = 50;
$events = $db->arraybuilder()->paginate("events", $page);
} else {
$db->orderBy('id', 'DESC');
$db->pageLimit = 50;
$events = $db->arraybuilder()->paginate("events", $page);
}
foreach ($events as $key => $row){
$row = index_array($row);
echo "<tr'>\n";
?>
<td>
<?php echo $row[0];?>
</td>
<td>
<i>
<?php echo $row[4];?>
</i>
</td>
<td>
<i>
<?php echo $row[2];?>
</i>
</td>
<td>
<?php echo $row[5];?>
</td>
</tr>
<?php
}
echo "</tbody><tfoot>showing {$page} out of {$db->totalPages}</tfoot></table></div><!-- /.box-body --></div>";
?>
<ul class="pagination pagination-sm no-margin pull-right">
<?php
for ($d=1; $d<=$db->totalPages; $d++) {
echo "<li><a href=\"{$config['web_addr']}/events/admin/".$d."/\">".$d."</a></li>";
};
}
?>
</ul>