Store in GIT
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require("../../inc/connect.php");
|
||||
require("../session.php");
|
||||
require("verify.php");
|
||||
|
||||
$session = $_GET['session'];
|
||||
|
||||
if($session == "")
|
||||
{
|
||||
JError("No session");
|
||||
}
|
||||
|
||||
$stream = $_GET['id'];
|
||||
$name = $_GET['name'];
|
||||
$ip = $_GET['ip'];
|
||||
$port = $_GET['port'];
|
||||
$path = $_GET['path'];
|
||||
|
||||
if($stream == "")
|
||||
{
|
||||
JError("No id");
|
||||
}
|
||||
if($name == "")
|
||||
{
|
||||
JError("No name");
|
||||
}
|
||||
if($ip == "")
|
||||
{
|
||||
JError("No ip");
|
||||
}
|
||||
if($port == "")
|
||||
{
|
||||
JError("No port");
|
||||
}
|
||||
if($path == "")
|
||||
{
|
||||
JError("No path");
|
||||
}
|
||||
|
||||
//check session
|
||||
verify_session($mysqli, $session);
|
||||
|
||||
//Check if stream editing 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 edit stream");
|
||||
}
|
||||
|
||||
//Fix input
|
||||
$ip = rtrim($ip, "/");
|
||||
$ip = ltrim($ip, "http://");
|
||||
$ip = ltrim($ip, "https://");
|
||||
$path = ltrim($path, "/");
|
||||
|
||||
//Check if stream is valid
|
||||
$resp = stream_verify($ip, $port, $path);
|
||||
|
||||
if($resp === false)
|
||||
{
|
||||
JError("invalid stream");
|
||||
}
|
||||
$ip = $resp;
|
||||
|
||||
//Update stream
|
||||
$sql = "UPDATE `stream` SET `name`='$name', `ip`='$ip', `port`='$port', `path`='$path' WHERE `id`=$stream";
|
||||
ExecQuery($mysqli, $sql);
|
||||
|
||||
JSuccess("true");
|
||||
?>
|
||||
Reference in New Issue
Block a user