| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- include_once('includes/db_connect.php');
- include_once('includes/global_functions.php');
- $radioid = $_GET['radioid'];
- $radiomac = $_GET['radiomac'];
-
- if($radioid == "" && $radiomac == ""){
- print(json_encode([error => "Not a valid radioid"]));
- die();
- }else{
- if($radiomac != ""){
- $radiomac = str_replace(':', '', $radiomac);
- $radioid = substr($radiomac, 6 , 11);
- }
-
- $array = array();
- if($stmt = $mysqli -> prepare("SELECT id, message, message, streamip, streamurl, streamport, tijd, snoozetijd FROM alarm LEFT JOIN users ON alarm.uid = users.uid WHERE users.radiotoken = ? LIMIT 5")){
- $stmt -> bind_param("s", $radioid);
- $stmt -> execute();
- $stmt -> bind_result($id, $message, $message, $streamip, $streamurl, $streamport, $tijdstr, $snoozetijd);
- while($result = $stmt -> fetch()){
- $tijd = strtotime($tijdstr);
- if($tijd < time()){
- $tijd = strtotime($tijdstr.' +1 day');
- }
- array_push($array, array( YYYY=> date("Y", $tijd),
- MM => date("m", $tijd),
- DD => date("d", $tijd),
- hh => date("H", $tijd),
- mm => date("i", $tijd),
- ss => date("s", $tijd),
- name => $message,
- ip => $streamip,
- id => $id,
- port => $streamport,
- url => $streamurl,
- st => $snoozetijd
- )
- );
- };
- $stmt -> close();
- }
- print(json_encode($array, JSON_UNESCAPED_SLASHES));
- }
-
-
|