<?php // Insert simulator URL if the user has authed. if(!isset($_GET['login']) && !isset($_GET['apiKey'])) return; // Authentication. if($_GET['login'] != 'WaSGW' && $_GET['apiKey'] != 'ab930aaf') return; // We got a collision. if(!isset($_GET['point'])) return; $point = $_GET['point']; $pa = str_getcsv($point); $db = new PDO('sqlite:gw_one.sqlite'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $q = $db->prepare("INSERT INTO gw_data(x,y,z) VALUES(:pa_x, :pa_y, :pa_z)"); try { $q->execute(array(':pa_x' => $pa[0], ':pa_y' => $pa[1], ':pa_z' => $pa[2])); } catch(PDOException $e) { die($e->getMessage()); } print "PACK"; return; ?>