34 lines
676 B
PHP
34 lines
676 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
require("../../inc/connect.php");
|
|
require("../session.php");
|
|
|
|
$session = $_GET['session'];
|
|
$id = $_GET['id'];
|
|
|
|
if($session == "")
|
|
{
|
|
JError("session not set");
|
|
}
|
|
if($id == "")
|
|
{
|
|
JError("id not set");
|
|
}
|
|
|
|
//check session
|
|
verify_session($mysqli, $session);
|
|
|
|
$sql = "SELECT `id` FROM `alarm` WHERE `dev_id`=$deviceid AND `id`=$id";
|
|
$query = ExecQuery($mysqli, $sql);
|
|
|
|
if($query->num_rows < 1)
|
|
{
|
|
JError("you cannot delete that alarm");
|
|
}
|
|
|
|
//update
|
|
$sql = "DELETE FROM `alarm` WHERE `id`=$id";
|
|
ExecQuery($mysqli, $sql);
|
|
|
|
JSuccess("true");
|
|
?>
|