2013-09-27 12:31:55 +02:00
|
|
|
<?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));
|
2014-03-07 12:28:34 +01:00
|
|
|
$boxes = $statement->fetchAll(PDO::FETCH_CLASS);
|
2013-09-27 12:31:55 +02:00
|
|
|
} catch (PDOException $e) {
|
|
|
|
$response = array( "status" => "error",
|
|
|
|
"msg" => $e->getMessage()." (".$e->getCode().")");
|
2013-09-27 18:47:03 +02:00
|
|
|
exit(json_encode($response)."\r\n");
|
2013-09-27 12:31:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$response = array( "status" => "success",
|
2014-03-07 12:28:54 +01:00
|
|
|
"data" => $boxes);
|
2013-09-27 18:47:03 +02:00
|
|
|
exit(json_encode($response)."\r\n");
|
2013-09-27 12:31:55 +02:00
|
|
|
?>
|