Store in GIT
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
require("../../../inc/connect.php");
|
||||
require("../../../inc/session.php");
|
||||
require("stream_verify.php");
|
||||
|
||||
$stream = $_POST['id'];
|
||||
$name = $_POST['name'];
|
||||
$ip = $_POST['ip'];
|
||||
$port = $_POST['port'];
|
||||
$path = $_POST['path'];
|
||||
|
||||
//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)
|
||||
{
|
||||
error("streams", "You are not allowed to edit that 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)
|
||||
{
|
||||
error("streams", "Invalid stream");
|
||||
}
|
||||
$ip = $resp;
|
||||
|
||||
//Update stream
|
||||
$sql = "UPDATE `stream` SET `name`='$name', `ip`='$ip', `port`='$port', `path`='$path' WHERE `id`=$stream";
|
||||
ExecQuery($mysqli, $sql);
|
||||
|
||||
success("streams", "The stream has been updated");
|
||||
?>
|
||||
Reference in New Issue
Block a user