Files
2026-08-13 18:33:10 +02:00

103 lines
2.6 KiB
PHP
Executable File

<?php
function writeIt ($inputMuster, $replaceString)
{
// Liest eine Datei in ein Array. Hier gehen wir über HTTP, um den
// HTML-Quelltext einer URL zu bekommen
$lines = file('status.json');
foreach ($lines as $line_num => $line) {
$gefunden = strpos($line,$inputMuster);
if($gefunden > 0 )
{
//echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n";
$lines[$line_num] = $replaceString;
// echo "NewLine #<b>{$line_num}</b> : " . htmlspecialchars($lines[$line_num]) . "<br>\n";
$fp = fopen('status.json', 'w');
foreach($lines as $values)
fputs($fp, $values);
fclose($fp);
}
}
}
if(isset( $_GET['asiOutputSelect']) )
{
$asiOutput = $_GET['asiOutputSelect'];
$intInput = intval($asiOutput);
if (is_numeric($asiOutput) && $intInput == $asiOutput && ( $asiOutput < 0 || $asiOutput > 6) )
{
echo "Command Failed - Value Out of Range";
}
else if( is_numeric($asiOutput) &&($asiOutput >= 0 && $asiOutput <= 6 && $intInput == $asiOutput ) )
{
echo "Command Done - asiOutputSelect=";
echo $asiOutput;
$outPutString = ' "asiOutputSelect": '.$asiOutput.", \r\n";
// echo $outPutString;
writeIt( "asiOutputSelect", $outPutString);
}else
{
echo "Command Failed - Value Not Accepted";
}
}else
if(isset( $_GET['remuxInputMask']) )
{
$remuxInput = $_GET['remuxInputMask'];
$intInput = intval($remuxInput);
if (is_numeric($remuxInput) && $intInput == $remuxInput && ( $remuxInput < 0 || $remuxInput > 7) )
{
echo "Command Failed - Value Out of Range";
}
else if( is_numeric($remuxInput) &&($remuxInput >= 0 && $remuxInput <= 7 && $intInput == $remuxInput ) )
{
echo "Command Done - RemuxInputMask=";
echo $remuxInput;
$outPutString = ' "remuxInputMask": '.$remuxInput.", \r\n";
// echo $outPutString;
writeIt( "remuxInputMask", $outPutString);
}else
{
echo "Command Failed - Value Not Accepted";
}
}
else
if(isset( $_GET['remuxBitrate']) )
{
$remuxBitrate = $_GET['remuxBitrate'];
$intInput = intval($remuxBitrate*10000);
$remuxBitrate =$intInput/10000;
if (is_numeric($intInput) && ( $intInput < 500 || $intInput > 1000000) )
{
echo "Command Failed - Value Out of Range";
}
else if( is_numeric($intInput) &&($intInput >= 500 && $intInput <= 1000000) )
{
echo "Command Done - RemuxInputMask=";
echo $remuxBitrate;
$outPutString = ' "remuxBitrate": '.$remuxBitrate.", \r\n";
// echo $outPutString;
writeIt( "remuxBitrate", $outPutString);
}else
{
echo "Command Failed - Value Not Accepted";
}
}
?>