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
|
<?php
if (!isset($_REQUEST['host']))
{
$_REQUEST['host'] = '%';
}
$host = $_REQUEST['host'];
try{
$dbHandle = new PDO("sqlite:rrd/ntpstatus.sqlite");
}catch( PDOException $exception ){
echo "Can NOT connect to sqlite3 database ntpstatus.sqlite";
die($exception->getMessage());
}
$sqlShowLog = "SELECT * FROM status WHERE host LIKE '${host}';";
$result = $dbHandle->query($sqlShowLog);
echo nl2br("date,host,offset,freq,sjit,cjit,wander,disp,jitter\n");
while ($entry = $result->fetch()) {
$date = $entry['date'];
$host = $entry['host'];
$offset = $entry['offset'];
$freq = $entry['freq'];
$sjit = $entry['sjit'];
$cjit = $entry['cjit'];
$wander = $entry['wander'];
$disp = $entry['disp'];
$output = "$date, $host, $offset, $freq, $sjit, $cjit, $wander, $disp, 0\n";
echo nl2br($output);
}
?>
|