-
Notifications
You must be signed in to change notification settings - Fork 0
/
analysis.php
58 lines (51 loc) · 1.37 KB
/
analysis.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
<?php
setlocale(LC_TIME, 'de_DE.utf8');
date_default_timezone_set('Europe/Berlin');
$nodelist = json_decode(file_get_contents('namedb.json'), true);
$statsf = fopen('stats.txt', 'r');
while(!feof($statsf)) {
$line = fgetcsv($statsf, 28, ' ');
if ($line[1] == $_GET['node']) {
$fractoff = floatval($line[0]);
break;
}
}
fclose($file_handle);
$statsmodified =filemtime('stats.txt');
?>
<!DOCTYPE HTML>
<html>
<head>
<title>FFHH: Statistiken</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/ffhh/style.css" />
</head>
<body>
</header>
<h1>Freifunk Hamburg</h1>
<h2>Offline Statistik</h2>
</header>
<?php include('navigation.php'); ?>
<section>
<table>
<tr>
<th>Offline [%]</th>
<th>Knoten</th>
</tr>
<?php
$statsf = fopen('stats.txt', 'r');
while(!feof($statsf)) {
$line = fgetcsv($statsf, 28, ' ');
$nodename=(isset($nodelist[$line[1]]) && strlen($nodelist[$line[1]]) > 0)?$nodelist[$line[1]]:wordwrap($line[1], 2, ':', true);?>
<tr>
<td class="offline"><? printf('%3.2f', $line[0]);?></td>
<td><a href="/ffhh/view/<?=$line[1];?>"><?=$nodename;?></a></td>
</tr>
<?php }
fclose($file_handle);
?>
</table>
</section>
<?php include('footer.php'); ?>
</body>
</html>