0
0
mirror of https://github.com/Doodle3D/doodle3d-connect.git synced 2024-11-16 19:17:56 +01:00
doodle3d-connect/api/list.php

26 lines
753 B
PHP
Raw Normal View History

<?php
require 'connect.php';
$hourago = time() - 60*60;
$remoteip = getenv('REMOTE_ADDR');
try {
$statement = $db->prepare("SELECT * FROM $table where date >= FROM_UNIXTIME(:hourago) AND remoteip = :remoteip");
$statement->execute(array( ':hourago' => $hourago,
':remoteip' => $remoteip));
$boxes = $statement->fetchAll();
} catch (PDOException $e) {
$response = array( "status" => "error",
"msg" => $e->getMessage()." (".$e->getCode().")");
exit(json_encode($response)."\r\n");
}
2013-09-30 17:34:27 +02:00
$debug = array( "time" => time(),
"hourago" => $hourago,
"remoteip" => $remoteip);
$response = array( "status" => "success",
2013-09-30 17:34:27 +02:00
"data" => $boxes,
"debug" => $debug);
exit(json_encode($response)."\r\n");
?>