90 || $lon < -180 || $lon > 180) die($LANG['location_invalid']."\n"); // Not all devices report speed and accuracy, but if available, report them too. $speed = isset($_POST["spd"]) ? floatval($_POST["spd"]) : null; $accuracy = isset($_POST["acc"]) ? floatval($_POST["acc"]) : null; $memcache = memConnect(); // Retrieve the session data from memcached. $sid = $_POST["sid"]; $session = new Client($memcache, $sid); if (!$session->exists()) die($LANG['session_expired']."\n"); // The location data object contains the sharing interval (i), duration (d) and // a location list (l). Each entry in the location list contains a latitude, // longitude, timestamp, accuracy and speed, in that order, as an array. $session->addPoint([$lat, $lon, $time, $accuracy, $speed])->save(); if ($session->hasExpired()) { echo $LANG['session_expired']."\n"; } else { echo "OK\n".getConfig("public_url")."?%s\n".implode(",", $session->getTargetIDs())."\n"; }