Add countdown option

Some more checks & safety
Encode for resolution 1920x1080, SAR 16:9, 25 fps, 18000 tbn
This commit is contained in:
pepa65 committed 2022-09-18 09:48:53 +07:00
1 parent 67be8d8863
commit 7c1f3b372c
7 files changed
+66 -17

No files matched your search

+25 -2
View File
@@ -1,6 +1,10 @@
<?php // Schedule page
require "check.php";
$user=$_SESSION['user'];
if(empty($user)){
header('Location: login.php');
}
print('<!DOCTYPE html>
<meta charset="utf-8">
<title>Stream Upload scheduling</title>
@@ -29,8 +33,27 @@ function filename(){
<input id="input" type="file" name="file" required accept=".mp4" onchange="filename()" autofocus>
<input class="abs" id="fakeinput" tabindex="-1">
<p class="abs" id="name">Click to select the video</p>
</div>
<select name="target" id="target" required title="Click to select where to stream to">
</div>');
// Check countdown options
$cf=file(__DIR__.'/../countdown',FILE_IGNORE_NEW_LINES & FILE_SKIP_EMPTY_LINES);
$n=0;
foreach($cf as $line){
if(substr($line, 0, 1)!='#'){
$field=explode("\t", $line);
$id[$n]=htmlspecialchars($field[0]);
$name[$n++]=htmlspecialchars($field[1]);
}
}
// Populate Countdown dropdown
if($n>0){
print(' <select name="id" title="Click to select an optional countdown">');
print(' <option value="_" selected>No countdown</option>');
for($i=0; $i<$n; ++$i){
print(' <option value="'.$id[$i].$name[$i].'">'.$name[$i].'</option>');
}
print(' </select>');
}
print(' <select name="target" required title="Click to select where to stream to">
<option value="" disabled selected hidden>Streaming Destination</option>
<option value="Restream">Restream</option>
<option value="Facebook">Facebook</option>
+1 -1
View File
@@ -1,7 +1,7 @@
<?php // Login page
session_start();
$user=$_POST['user'];
if(!empty($user)){ // Login attempt
if(!empty($user) && preg_match('/[A-Za-z0-9]+/', $user)!==false){ // Login attempt and valid input
// Read hash and check password
$mh=file(__DIR__.'/../mailhash',FILE_IGNORE_NEW_LINES & FILE_SKIP_EMPTY_LINES);
foreach($mh as $line){
+17 -8
View File
@@ -23,11 +23,16 @@ foreach($mh as $line){
}
}
$upload=htmlspecialchars(basename($_FILES['file']['name']));
$key=$_POST['streamkey'];
$date=$_POST['date'];
$time=$_POST['time'];
$email=$_POST['email'];
$target=$_POST['target'];
$key=htmlspecialchars($_POST['streamkey']);
$date=htmlspecialchars($_POST['date']);
$time=htmlspecialchars($_POST['time']);
$email=htmlspecialchars($_POST['email']);
$target=htmlspecialchars($_POST['target']);
$id=htmlspecialchars($_POST['id']);
if(substr($id, 0, 1)!=='_'){
$countdown=substr($id, 1);
}
$id=substr($id, 0, 1);
if($email){
$to=$email;
$email=':'.$email;
@@ -38,7 +43,7 @@ $hour=substr($time, 0, 2);
$min=substr($time, 3, 2);
$tme=$hour.$min;
$dir='streams/';
$name=$key.'.'.$date.'_'.$tme.'_'.$user.$email.'@'.$target;
$name=$key.'.'.$date.'_'.$tme.$id.$user.$email.'@'.$target;
$file=$dir.$name.'.upload';
print('<!DOCTYPE html>
<meta charset="utf-8">
@@ -72,7 +77,11 @@ if(!move_uploaded_file($_FILES['file']['tmp_name'], $file)){
Back('Error moving the file');
}
print('<p>Streaming <b>'.$name.'.mp4</b></p>');
print('<p>When done encoding, email <b>'.$to.'</b></p>');
print('<p>Streaming <b>'.$name.'.mp4</b>');
if(isset($countdown)){
print('<br><br>using <b>'.$countdown.'</b>');
}
print('</p>
<p>When done encoding, email <b>'.$to.'</b></p>');
Back('Streaming on <b>'.$date.'</b> at <b>'.$time.'</b>h on <b>'.$target.'</b>');
?>