Input notify email

This commit is contained in:
pepa65 committed 2022-08-31 10:54:33 +07:00
1 parent 63643b840e
commit 555c7b7444
5 files changed
+34 -19

No files matched your search

+7 -4
View File
@@ -25,13 +25,16 @@ function respond(){
</td></tr>
<tr>
<td class="left">Streamkey:</td>
<td class="right"><input type="text" name="streamkey" id="streamkey" required title="string of 0-9, a-z, A-Z, underscore or dash characters" pattern="[a-zA-Z0-9_-]+"></td></tr>
<td class="right"><input type="text" name="streamkey" required title="string of 0-9, a-z, A-Z, underscore or dash characters" pattern="[a-zA-Z0-9_-]+"></td></tr>
<tr>
<td>Date and Time:</td>
<td><input type="datetime-local" name="datetime" id="datetime" required></td></tr>
<td>Date & Time:</td>
<td><input type="datetime-local" name="datetime" required></td></tr>
<tr>
<td>Video File:</td>
<td><input type="file" name="fileToUpload" id="fileToUpload" required accept=".mp4"></td></tr>
<td><input type="file" name="file" required accept=".mp4"></td></tr>
<tr>
<td class="left">Notify email:</td>
<td class="right"><input type="email" name="email" title="Not required"></td></tr>
<tr><td><br></td></tr>
<tr><td></td><td><input type="submit" value="Schedule Stream" name="submit"></td></tr>
<tr><td><br></td></tr>
+1 -1
View File
@@ -1,4 +1,4 @@
input[type=text],[type=file], select, [type=time], [type=date], [type=datetime-local] {
input,select {
width:100%;
padding:12px 20px;
margin:0;
+13 -6
View File
@@ -14,16 +14,20 @@ function Back($msg){
}
header('Content-type: text/html; charset=utf-8');
$upload=htmlspecialchars(basename($_FILES['fileToUpload']['name']));
$upload=htmlspecialchars(basename($_FILES['file']['name']));
$key=$_POST['streamkey'];
$datetime=$_POST['datetime'];
$email=$_POST['email'];
if($email){
$email='='.$email;
}
$date=substr($datetime, 0, 10);
$hour=substr($datetime, 11, 2);
$min=substr($datetime, 14, 2);
$time=$hour.$min;
$target=$_POST['target'];
$dir='streams/';
$name=$key.'.'.$date.'_'.$time.'@'.$target;
$name=$key.'.'.$date.'_'.$time.$email.'@'.$target;
$file=$dir.$name.'.upload';
print('<!DOCTYPE html>
<meta charset="utf-8">
@@ -44,13 +48,16 @@ $nextyear=date('Y-m-dHi', strtotime('+1 year'));
if(strcmp($nextyear, $date.$time)<0){
Back('Scheduling too far into the future: '.$date.' '.$time);
}
if($_FILES['fileToUpload']['error']!=UPLOAD_ERR_OK){
if($_FILES['file']['error']!=UPLOAD_ERR_OK){
Back('Error uploading the file');
}
if(!move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $file)){
if(!move_uploaded_file($_FILES['file']['tmp_name'], $file)){
Back('Error moving the file');
}
Back('File is now being encoded to "'.$name.'.mp4"<br>&nbsp;<br>
Scheduling for '.$date.' at '.$hour.':'.$min.'h on '.$target);
print('File is now being encoded to "'.$name.'.mp4"<br>&nbsp;<br>');
if($email){
print('When done, an email will be sent to: '.substr($email,1));
}
Back('Scheduling for '.$date.' at '.$hour.':'.$min.'h on '.$target);
?>