You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1000 B
PHTML
26 lines
1000 B
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
include('config.inc.php');
|
||
|
|
||
|
$db = new PDO('mysql:host=' . $config['host'] . ';dbname=' . $config['database'], $config['dbuser'], $config['password'], [
|
||
|
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
|
||
|
\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4'"
|
||
|
]);
|
||
|
// $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE , PDO::FETCH_ASSOC );
|
||
|
|
||
|
$term_id = intval($_GET['term_id']);
|
||
|
$ts = intval($_GET['ts']);
|
||
|
$channel = intval($_GET['ch']);
|
||
|
|
||
|
$result = array('res' => 0, 'data' => array());
|
||
|
$sql = "SELECT id,orginal_id,channel_id,preset_id,media_type, FROM_UNIXTIME(photo_time) AS photo_time,`path`,`thumb`,FROM_UNIXTIME(`recv_time`) AS recv_time FROM terminal_photos WHERE term_id="
|
||
|
. $term_id . " AND recv_time >= " . $ts . " AND channel_id=" . $channel . " AND media_type<>2 ORDER BY photo_time DESC";
|
||
|
|
||
|
$stmt = $db->prepare($sql);
|
||
|
$stmt->execute();
|
||
|
$rows = $stmt->fetchAll();
|
||
|
|
||
|
|
||
|
header ('Content-type: application/json; charset=utf-8');
|
||
|
echo json_encode($rows, JSON_UNESCAPED_UNICODE);
|