* knowledge of the CeCILL-B license and that you accept its terms. */ include_once '../../config.php'; include_once '../../functions/general.php'; /** * This script returns GeoJSON */ header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Content-type: application/json; charset=utf-8"); /** * Database connection */ $dbh = getVerifiedConnection($_REQUEST, array($_POST['email']), false) or die('{"error":{"message":"Problem on database connection"}}'); /** * Authentication can be done with sessionid or password * Password authentication as preseance if both variables are set */ if (isset($_POST['password'])) { $authFromPassword = true; } else { if (isset($_POST['sessionid'])) { $authFromPassword = false; } else { die('{"error":{"message":"Problem on database connection"}}'); } } /** * Prepare query
* knowledge of the CeCILL-B license and that you accept its terms. */ include_once '../../config.php'; include_once '../../functions/general.php'; /** * This script returns JSON */ header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Content-type: application/json; charset=utf-8"); /** * Database connection */ $dbh = getVerifiedConnection($_REQUEST, array($_REQUEST["userid"]), false) or die('{"error":{"message":"Error : cannot retrieve contexts"}}'); /* * Identifier */ $userid = $_REQUEST["userid"]; /** * Prepare query */ $query = "SELECT location,date_trunc('minute', utc),context FROM contexts WHERE userid ='" . pg_escape_string($userid) . "' ORDER BY utc DESC"; $results = pg_query($dbh, $query) or die("Error in SQL query: " . pg_last_error()); $json = array('contexts' => array()); /* * Retrieve context */ if (pg_num_rows($results) > 0) { $tmp = array();
*/ include_once '../../config.php'; include_once '../../functions/general.php'; include_once '../../functions/geometry.php'; /** * This script returns JSON */ header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Content-type: application/json; charset=utf-8"); /** * Database connection */ $dbh = getVerifiedConnection($_REQUEST, array($_POST["bbox"], $_POST["context"]), true) or die('{"error":{"message":"Error : cannot save context"}}'); /** * Get the bbox from input parameters. * bbox=lonMin,latMin,lonMax,latMax */ $wktCenter = bboxToWKTCenter($_POST["bbox"]); $context = $_POST["context"]; $error = '{"error":{"message":"Error : cannot save context"}}'; /* * No context */ if ($context == "") { echo $error; exit(0); } /*
* knowledge of the CeCILL-B license and that you accept its terms. */ include_once '../../config.php'; include_once '../../functions/general.php'; /** * This script returns GeoJSON */ header("Pragma: no-cache"); header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Content-type: application/json; charset=utf-8"); /** * Database connection */ $dbh = getVerifiedConnection($_REQUEST, array($_POST['email'], $_POST['username']), false) or die('{"error":{"message":"Error : registering is currently unavailable"}}'); /** * First check if user exist */ $query = "SELECT userid FROM users WHERE email='" . pg_escape_string(strtolower($_POST['email'])) . "'"; $result = pg_query($dbh, $query) or die('{"error":{"message":"Error : registering is currently unavailable"}}'); $userid = -1; while ($user = pg_fetch_row($result)) { $userid = $user[0]; } /** * User does not exist => generate a password and insert new user within database */ if ($userid == -1) { /* * Create a new password