22 lines
861 B
PHP
22 lines
861 B
PHP
<?php
|
|
//Scrape current list of registered streamers from the json file that contains them from a non-web accessible folder
|
|
$validStreamers = json_decode(file_get_contents(realpath('../auth.json')));
|
|
|
|
//For each streamer
|
|
foreach($validStreamers as $curStreamer){
|
|
//If the given stream key matches the current registered streamer
|
|
if(password_verify($_POST['name'], $curStreamer->hash)){
|
|
//Log Stream
|
|
file_put_contents("status.json", json_encode(array("status"=>array("name"=>$curStreamer->name, "time"=>time()))));
|
|
|
|
//Redirect to the public stream
|
|
header("Location: rtmp://127.0.0.1/public/index");
|
|
|
|
//Prevent further execution
|
|
die();
|
|
}
|
|
}
|
|
|
|
//If we fell through the loop with no matches, return 403 forbidden
|
|
http_response_code(403);
|
|
?>
|