Store in GIT

This commit is contained in:
2026-06-17 15:46:26 +02:00
parent 47150cc7ca
commit 876ad89e72
134 changed files with 31034 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
header('Content-Type: application/json');
require("../../inc/connect.php");
require("../session.php");
$session = $_GET['session'];
if($session == "")
{
JError("no session");
}
//check session
verify_session($mysqli, $session);
JError("not implemented");
?>
+17
View File
@@ -0,0 +1,17 @@
<?php
header('Content-Type: application/json');
require("../../inc/connect.php");
require("../session.php");
$session = $_GET['session'];
if($session == "")
{
JError("no session");
}
//check session
verify_session($mysqli, $session);
JError("not implemented");
?>
+89
View File
@@ -0,0 +1,89 @@
<?php
header('Content-Type: application/json');
require("../../inc/connect.php");
require("../session.php");
$session = $_GET['session'];
if($session == "")
{
JError("no session");
}
$schedule = $_GET['id'];
$name = $_GET['name'];
$time = $_GET['time'];
$duration = $_GET['duration'];
$stream = $_GET['stream'];
if($schedule == "")
{
JError("no id");
}
if($name == "")
{
JError("no name");
}
if($time == "")
{
JError("no time");
}
if($duration == "")
{
JError("no duration");
}
if($stream == "")
{
JError("no stream");
}
//check session
verify_session($mysqli, $session);
//Check if alarms editing is allowed
$sql = "SELECT `name` FROM `schedule` WHERE `dev_id`=$deviceid AND `id`=$schedule";
$query = ExecQuery($mysqli, $sql);
if($query->num_rows < 1)
{
JError("cannot edit schedule");
}
//Check if stream is allowed
$sql = "SELECT `name` FROM `stream` WHERE `dev_id`=$deviceid AND `id`=$stream";
$query = ExecQuery($mysqli, $sql);
if($query->num_rows < 1)
{
JERROR("cannot use stream");
}
//Remove seconds
$time = substr($time, 0, 5);
//Check time
if(!preg_match("/(2[0-3]|[01][0-9]):([0-5][0-9])/", $time))
{
JError("invalid time");
}
$time .= ":00";
//Remove seconds
$duration = substr($duration, 0, 5);
//Check duration
if(!preg_match("/(2[0-3]|[01][0-9]):([0-5][0-9])/", $duration))
{
JError("invalid duration");
}
$duration .= ":00";
//Add schedule
$sql = "UPDATE `schedule` SET `name`='$name', `time`='$time', `duration`='$duration', `stream`=$stream WHERE `id`=$schedule";
ExecQuery($mysqli, $sql);
JSuccess("true");
?>
+52
View File
@@ -0,0 +1,52 @@
<?php
header('Content-Type: application/json');
require("../../inc/connect.php");
require("../session.php");
$session = $_GET['session'];
if($session == "")
{
echo '{"error":"No session"}';
exit;
}
//check session
verify_session($mysqli, $session);
//Check devices
$sql = "SELECT schedule.id AS `id`, schedule.name AS `name`, schedule.time AS `time`, schedule.duration AS `duration`, stream.name AS `stream` FROM `schedule`, `session`, `stream` WHERE schedule.stream = stream.id AND schedule.dev_id = session.dev_id AND `session`='$session'";
$query = ExecQuery($mysqli, $sql);
if($query->num_rows < 1)
{
echo '{"error":"No schedules found"}';
exit;
}
$str = '{"succes":true, "device":"' . $device . '", "schedules":[';
$count = 1;
while($result = $query->fetch_assoc())
{
$str .= '{"id":' . $result['id'] . ',';
$str .= '"name":"' . $result['name'] . '",';
$str .= '"time":"' . $result['time'] . '",';
$str .= '"duration":"' . $result['duration'] . '",';
$str .= '"stream":"' . $result['stream'] . '"';
if($count == $query->num_rows)
$str .= '}';
else
$str .= '},';
$count++;
}
$str .= ']}';
echo $str;
?>