diff options
author | Matt Rude <[email protected]> | 2011-06-22 22:10:28 -0500 |
---|---|---|
committer | Matt Rude <[email protected]> | 2011-06-22 22:10:28 -0500 |
commit | d11479ea97aabc2e5bc82b8b11edc3be61254019 (patch) | |
tree | 17ae11d333aa2c6497a4fb21a57dbe70df252a33 /csv.php | |
parent | 7ea45fab6cc3664e09323b0f5b09ff71642d1992 (diff) | |
download | time.mattrude.com-d11479ea97aabc2e5bc82b8b11edc3be61254019.tar.gz time.mattrude.com-d11479ea97aabc2e5bc82b8b11edc3be61254019.tar.bz2 time.mattrude.com-d11479ea97aabc2e5bc82b8b11edc3be61254019.zip |
Revert "Revert "Adding a quick dojo csv export page""
This reverts commit 8ad1aeca76af5838425dd4c5591d25e5e2d78f68.
Diffstat (limited to 'csv.php')
-rw-r--r-- | csv.php | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,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); +} + +?> |