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.
28 lines
946 B
PHTML
28 lines
946 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']);
|
||
|
$st = intval($_GET['st']);
|
||
|
$et = intval($_GET['et']);
|
||
|
|
||
|
$result = array('res' => 0, 'data' => array());
|
||
|
$sql = "SELECT FROM_UNIXTIME(heartbeat_time) AS heartbeat_time,heartbeat_ip,heartbeat_port FROM terminal_heartbeat_history WHERE term_id="
|
||
|
. $term_id . " AND heartbeat_time BETWEEN " . $st . " AND " . $et . " ORDER BY heartbeat_time DESC";
|
||
|
|
||
|
header ('SQL: ' . $sql);
|
||
|
|
||
|
$stmt = $db->prepare($sql);
|
||
|
$stmt->execute();
|
||
|
$rows = $stmt->fetchAll();
|
||
|
|
||
|
|
||
|
header ('Content-type: application/json; charset=utf-8');
|
||
|
echo json_encode($rows, JSON_UNESCAPED_UNICODE);
|