forked from nerdbaggy/StatusPage
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchecklogs.php
67 lines (49 loc) · 1.37 KB
/
checklogs.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
<?php
include '../config.php';
include 'statuspage.php';
$cid =$_GET["cid"];
//Validation
if (!is_numeric($cid) || strlen($cid) > 20){
die("Invalid Check ID");
}
$checks = curlCall($cid);
if ($checks == False){
die ("An error occured, please try again");
}
$cname = $checks[monitors][monitor][0][friendlyname];
echo "<h4>Logs for $cname</h4>";
echo "<hr>";
?>
<table style="width: 100%;">
<thead>
<tr>
<th>Event</th>
<th>Date-Time</th>
<th>Duration</th>
</tr>
</thead>
<tbody>
<?php
$logs = $checks[monitors][monitor][0][log];
foreach ($logs as $key => $log) {
echo "<tr>";
if ($log[type] == 1){
echo "<td><div class=\"alert label radius\"><i class=\"fi-arrow-down\"></i> Down</div></td>";
}elseif ($log[type] == 2) {
echo "<td><div class=\"success label radius\"><i class=\"fi-arrow-up\"></i> Up</div></td>";
}elseif ($log[type] == 98) {
echo "<td><div class=\"secondary label radius\"><i class=\"fi-play\"></i> Started</div></td>";
}elseif ($log[type] == 99) {
echo "<td><div class=\"secondary label radius\"><i class=\"fi-pause\"></i> Paused</div></td>";
}
echo "<td>$log[datetime]</td>";
if ($key == 0){
echo timeChange(date('d-n-Y H:i:s'), $log[datetime], $checks['timezone']/60);
}else {
echo timeChange($logs[$key-1][datetime], $log[datetime]);
}
echo "</tr>";
}
?>
</tbody>
</table>