forked from mojeda/ServerStatus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
51 lines (48 loc) · 1.5 KB
/
index.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
<?php
include('./includes/config.php');
global $sJavascript, $sTable;
$query = mysql_query("SELECT * FROM servers ORDER BY id") or die(mysql_error());
$sJavascript .= '<script type="text/javascript">
function uptime() {
$(function() {';
while($result = mysql_fetch_array($query)){
$sJavascript .= '$.getJSON("pull/index.php?url='.$result["id"].'",function(result){
$("#online'.$result["id"].'").html(result.online);
$("#uptime'.$result["id"].'").html(result.uptime);
$("#load'.$result["id"].'").html(result.load);
$("#memory'.$result["id"].'").html(result.memory);
$("#hdd'.$result["id"].'").html(result.hdd);
});';
$sTable .= '
<tr>
<td id="online'.$result["id"].'">
<div class="progress">
<div class="bar bar-danger" style="width: 100%;"><small>Down</small></div>
</div>
</td>
<td>'.$result["name"].'</td>
<td>'.$result["type"].'</td>
<td>'.$result["host"].'</td>
<td>'.$result["location"].'</td>
<td id="uptime'.$result["id"].'">n/a</td>
<td id="load'.$result["id"].'">n/a</td>
<td id="memory'.$result["id"].'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
<td id="hdd'.$result["id"].'">
<div class="progress progress-striped active">
<div class="bar bar-danger" style="width: 100%;"><small>n/a</small></div>
</div>
</td>
</tr>
';
}
$sJavascript .= '});
}
uptime();
setInterval(uptime, '.$sSetting['refresh'].');
</script>';
include($index);
?>