-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
35 lines (31 loc) · 779 Bytes
/
Copy pathindex.php
File metadata and controls
35 lines (31 loc) · 779 Bytes
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
<?php
$fh = fopen ( "stats.conf", "r" );
if(!$fh){
$fh = fopen ( "vnstat/stats.conf", "r" );
}
if ($fh) {
while ( ($buffer = fgets ( $fh, 4096 )) !== false ) {
$buffer = str_replace ( "\"", "", $buffer );
$splitted_line = explode ( "=", $buffer );
if ($splitted_line [0] == "interfaces") {
$interfaces = explode ( " ", $splitted_line [1] );
}
if ($splitted_line [0] == "outputs") {
$outputs = explode ( " ", $splitted_line [1] );
}
}
fclose ( $fh );
}
echo "<html><body><h1>Traffic Statistiken ";
echo gethostname ();
echo "</h1>";
echo "<table>";
foreach ( $outputs as $mode ) {
echo "<tr>";
foreach ( $interfaces as $iface ) {
echo "<td><img src=\"" . $iface . "_" . $mode . ".png\" /></td>";
}
echo "</tr>";
}
echo "</table></body></html>";
?>