31 lines
710 B
PHP
31 lines
710 B
PHP
<?php
|
|
require("../../../inc/connect.php");
|
|
require("../../../inc/session.php");
|
|
require("stream_verify.php");
|
|
|
|
$name = $_POST['name'];
|
|
$ip = $_POST['ip'];
|
|
$port = $_POST['port'];
|
|
$path = $_POST['path'];
|
|
|
|
//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;
|
|
|
|
//Add stream
|
|
$sql = "INSERT INTO `stream` (`dev_id`, `name`, `ip`, `port`, `path`) VALUES ($deviceid, '$name', '$ip', '$port', '$path')";
|
|
ExecQuery($mysqli, $sql);
|
|
|
|
success("streams", "The stream has been added");
|
|
?>
|