From 02d23237d43b05da3d565a2041b6cc8c95638b1b Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sun, 7 Aug 2016 22:07:00 +0200 Subject: [PATCH] Add access.php - Users should make sure that ths is behind some sort of authentication... --- access.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 access.php diff --git a/access.php b/access.php new file mode 100644 index 0000000..c432625 --- /dev/null +++ b/access.php @@ -0,0 +1,51 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +$sql = "SELECT ts, lat, lon FROM tracker ORDER BY ts ASC;"; +$result = $conn->query($sql); + +if ($result->num_rows > 0) { + header('Content-Type: application/vnd.google-earth.kml+xml'); + header('Content-Disposition: attachment; filename="export.kml"'); + echo ' + + + +#yellowPoly + +1 +1 +absolute + +'; + + while($row = $result->fetch_assoc()) { + echo $row["lon"] . "," . $row["lat"] . "\n"; + } + + echo ' + +'; + +} else { + die("No records found."); +} + +$conn->close(); + +?> +