Files
Streaming/streamadd.php
2023-01-28 20:14:55 +01:00

35 lines
1.2 KiB
PHP
Executable File

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$heslo = trim($_POST['heslo']);
if (password_verify($heslo, file_get_contents("secrets/AdminPwdHash"))) {
$kod = $_POST['kod'];
$url = $_POST['url'];
$type = $_POST['type'];
$adminpwd = $_POST['adminpwd'];
$fol = 'streamy/' . $kod . '/';
$address1 = $fol . 'config.json';
$address2 = $fol . 'chat.txt';
$address3 = $fol . 'people.json';
$address4 = $fol . 'id.txt';
if (file_exists($address1)) {
echo ("Stream existuje!");
} else {
mkdir($fol);
$myObj = array(
"url" => $url,
"type" => $type,
"adminpwd" => $adminpwd
);
$myJson = json_encode($myObj);
file_put_contents($address1, $myJson);
file_put_contents($address2, '');
file_put_contents($address3, "{}");
file_put_contents($address4, "1");
echo "Stream pridaný";
}
} else {
echo "Zlé heslo.";
}
}
echo str_replace("__VLOZ_ROK__", date("Y"), file_get_contents("templates/streamadd.html"));
?>