Renames
This commit is contained in:
1 parent
ab642d9c51
commit
9abad2f998
13 files changed
+57
-41
No files matched your search
Executable
+9
@@ -0,0 +1,9 @@
|
||||
<?php // INCLUDE: Redirect to login.php if not authorized
|
||||
session_start();
|
||||
if(isset($_POST['logoff'])){ // Logout attempt: logout
|
||||
unset($_SESSION['user']);
|
||||
}
|
||||
if(!isset($_SESSION['user'])){ // Not logged in: login
|
||||
header('Location: login.php');
|
||||
}
|
||||
?>
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
Executable
+76
@@ -0,0 +1,76 @@
|
||||
<?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>
|
||||
<link rel="icon" href="favicon.png">
|
||||
<link rel="stylesheet" href="page.css">
|
||||
<script>
|
||||
function respond(){
|
||||
const feedback = document.getElementById("response");
|
||||
feedback.innerHTML = "<b>File is uploading</b>";
|
||||
}
|
||||
function filename(){
|
||||
var name = document.getElementById("name");
|
||||
name.innerHTML = document.getElementById("input").files[0].name;
|
||||
name.style.fontWeight = "normal";
|
||||
}
|
||||
</script>
|
||||
<div class="user"><p class="user">User: <b>'.$user.'</b></p>
|
||||
<form action="login.php" method="post">
|
||||
<input id="logoff" type="submit" name="logoff" value="Logoff">
|
||||
</form></div>
|
||||
<div class="container">
|
||||
<div class="incontainer">
|
||||
<h1>Stream Upload</h1>
|
||||
<form action="upload.php" method="post" enctype="multipart/form-data" onsubmit="respond()">
|
||||
<div class="fileinput">
|
||||
<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>');
|
||||
if($user!=='library' && $user!=='pp'){ ///////////////////////////////
|
||||
// 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].'</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>
|
||||
<option value="YouTube">YouTube</option>
|
||||
</select>
|
||||
<input type="text" name="streamkey" placeholder="Stream Key" required title="Enter a string of 0-9, a-z, A-Z, underscore or dash characters" pattern="[a-zA-Z0-9_-]+">
|
||||
<div class="datetime">
|
||||
<input type="date" name="date" title="Enter the date" required>
|
||||
<input type="time" name="time" title="Enter the time" required></div>
|
||||
<input type="email" name="email" placeholder="Email to notify" title="Not required">
|
||||
<input type="submit" value="Schedule Stream" name="schedule">');
|
||||
}else{ //////////////////////////////////
|
||||
print(' <input type="submit" value="Upload" name="schedule">'); ///////////////////////
|
||||
} ////////////////////////////////////
|
||||
print(' <p id="response"> </p>
|
||||
</form>
|
||||
</div>
|
||||
</div>');
|
||||
?>
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
<?php // Login page
|
||||
session_start();
|
||||
$user=@$_POST['user'];
|
||||
if(!empty($user) && preg_match('/[A-Za-z0-9]+/', $user)!==false){ // Login attempt and valid input
|
||||
// Read hash and check password
|
||||
$mh=file(__DIR__.'/../accounts',FILE_IGNORE_NEW_LINES & FILE_SKIP_EMPTY_LINES);
|
||||
foreach($mh as $line){
|
||||
if(substr($line, 0, 1)!='#'){
|
||||
$field=explode("\t", trim($line, "\n"));
|
||||
$hashes[$field[0]]=$field[2];
|
||||
if($field[0]==$user){
|
||||
if(password_verify($_POST['password'], $field[2])){ // Password correct: login
|
||||
$_SESSION['user']=$user;
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// New login attempt
|
||||
print('<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Stream Upload login</title>
|
||||
<link rel="icon" href="favicon.png">
|
||||
<link rel="stylesheet" href="page.css">
|
||||
<div class="container">
|
||||
<div class="incontainer">
|
||||
<h1>Stream Upload</h1>');
|
||||
if(isset($_POST['login'])){
|
||||
print('
|
||||
<h4>Invalid Username or Password</h4>');
|
||||
}
|
||||
print('
|
||||
<form action="login.php" method="post">
|
||||
<input type="text" name="user" placeholder="Username" required title="string of 0-9, a-z, A-Z" pattern="[a-zA-Z0-9]+">
|
||||
<input type="password" name="password" placeholder="Password" required>
|
||||
<input type="submit" name="login" value="Login" autofocus>
|
||||
</form>
|
||||
</div>
|
||||
</div>');
|
||||
?>
|
||||
Executable
+134
@@ -0,0 +1,134 @@
|
||||
body {
|
||||
background-color:#eee;
|
||||
margin:0;
|
||||
font-family:sans-serif;
|
||||
font-size:16px;
|
||||
text-align:center;
|
||||
}
|
||||
.user {
|
||||
display:flex;
|
||||
width:100%;
|
||||
justify-content:left;
|
||||
background-color:#ccc;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
p.user {
|
||||
margin:0;
|
||||
padding:.9em;
|
||||
}
|
||||
#logoff {
|
||||
margin:0;
|
||||
background-color:darkorange;
|
||||
width:100px;
|
||||
}
|
||||
.container {
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
justify-content:center;
|
||||
align-items:center;
|
||||
height:95vh;
|
||||
}
|
||||
.incontainer {
|
||||
width:325px;
|
||||
max-width:325px;
|
||||
}
|
||||
h4 {
|
||||
border-radius:4px;
|
||||
background-color:red;
|
||||
padding:.9em;
|
||||
}
|
||||
::file-selector-button {
|
||||
-moz-opacity:0;
|
||||
filter:alpha(opacity:0);
|
||||
opacity:0;
|
||||
}
|
||||
.fileinput {
|
||||
position:relative;
|
||||
max-width:fit-content(325px);
|
||||
}
|
||||
#name {
|
||||
padding-top:5px;
|
||||
font-weight:bold;
|
||||
width:100%;
|
||||
text-align:center;
|
||||
white-space:nowrap;
|
||||
overflow:hidden;
|
||||
text-overflow:ellipsis;
|
||||
}
|
||||
input.abs {
|
||||
background-color:#cfc;
|
||||
padding:14px 20px;
|
||||
margin:8px 0;
|
||||
border:1px solid #aaa;
|
||||
border-radius:4px;
|
||||
box-sizing:border-box;
|
||||
cursor:pointer;
|
||||
font-size:16px
|
||||
}
|
||||
.abs {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left:0px;
|
||||
z-index:1;
|
||||
}
|
||||
#input {
|
||||
position:relative;
|
||||
-moz-opacity:0;
|
||||
filter:alpha(opacity:0);
|
||||
opacity:0;
|
||||
z-index:2;
|
||||
}
|
||||
input,select {
|
||||
background-color:#fff;
|
||||
text-align:center;
|
||||
width:100%;
|
||||
padding:12px 20px;
|
||||
margin:3px 0;
|
||||
display:inline-block;
|
||||
border:1px solid #aaa;
|
||||
border-radius:4px;
|
||||
box-sizing:border-box;
|
||||
font-size:16px;
|
||||
font-weight:bold;
|
||||
}
|
||||
select {
|
||||
background-color:#fff;
|
||||
margin-top:5px;
|
||||
cursor:pointer;
|
||||
padding-top:12px;
|
||||
padding-bottom:-7px;
|
||||
}
|
||||
input[type=datetime-local] {
|
||||
cursor:pointer;
|
||||
}
|
||||
input[type=email] {
|
||||
margin-bottom:15px;
|
||||
}
|
||||
input[type=file] {
|
||||
text-align:left;
|
||||
cursor:pointer;
|
||||
}
|
||||
input[type=submit] {
|
||||
background-color:#4CAF50;
|
||||
color:white;
|
||||
padding:14px 20px;
|
||||
margin:10px 0;
|
||||
border:none;
|
||||
cursor:pointer;
|
||||
}
|
||||
.datetime {
|
||||
display:flex;
|
||||
flex-direction:rows;
|
||||
text-align:center;
|
||||
justify-content:space-between;
|
||||
}
|
||||
input[type=date] {
|
||||
width:56%;
|
||||
padding-left:0;
|
||||
padding-right:0;
|
||||
}
|
||||
input[type=time] {
|
||||
width:42%;
|
||||
padding-left:0;
|
||||
padding-right:0;
|
||||
}
|
||||
Executable
+107
@@ -0,0 +1,107 @@
|
||||
<?php // Encode page
|
||||
require "check.php";
|
||||
$user=$_SESSION['user'];
|
||||
if(!isset($_POST['schedule']) || empty($user)){ // If not post: start again
|
||||
header('Location: index.php');
|
||||
}
|
||||
|
||||
function Back($msg){
|
||||
if(empty($msg)){
|
||||
print('
|
||||
<p style="padding:5px;background-color:green;color:white"><b>File successfully uploaded, encoding started</b></p>');
|
||||
}else{
|
||||
print('
|
||||
<p style="padding:5px;background-color:red;color:white"><b>ERROR: '.$msg.'</b></p>');
|
||||
}
|
||||
print('
|
||||
<form action="index.php" method="post">
|
||||
<input type="submit" value="Upload another file" name="submit" autofocus>
|
||||
</form></div>');
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get mails
|
||||
$mh=file(__DIR__.'/../accounts',FILE_IGNORE_NEW_LINES & FILE_SKIP_EMPTY_LINES);
|
||||
foreach($mh as $line){
|
||||
if(substr($line, 0, 1)!='#'){
|
||||
$field=explode("\t", $line);
|
||||
$mails[$field[0]]=$field[1];
|
||||
}
|
||||
}
|
||||
$upload=htmlspecialchars(basename($_FILES['file']['name']));
|
||||
$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(empty($id)){
|
||||
$id='_';
|
||||
}
|
||||
if(substr($id, 0, 1)!=='_'){
|
||||
$countdown=substr($id, 1);
|
||||
$id=substr($id, 0, 1);
|
||||
}
|
||||
if($email){
|
||||
$to=$email;
|
||||
$email=':'.$email;
|
||||
}else{
|
||||
$to=$mails[$user];
|
||||
}
|
||||
$hour=substr($time, 0, 2);
|
||||
$min=substr($time, 3, 2);
|
||||
$tme=$hour.$min;
|
||||
$dir='streams/';
|
||||
$name=$key.'.'.$date.'_'.$tme.$id.$user.$email.'@'.$target;
|
||||
if($user=='library' || $user=='pp'){ ////////////////////////
|
||||
move_uploaded_file($_FILES['file']['tmp_name'], $dir.'video.'.$user);
|
||||
sleep(15);
|
||||
session_unset();
|
||||
header('Location: login.php');
|
||||
} ///////////////////////
|
||||
$file=$dir.$name.'.upload';
|
||||
print('<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Stream Upload encoding</title>
|
||||
<link rel="icon" href="favicon.png">
|
||||
<link rel="stylesheet" href="page.css">
|
||||
<div class="user"><p class="user">User: <b>'.$user.'</b></p>
|
||||
<form action="login.php" method="post">
|
||||
<input id="logoff" type="submit" name="logoff" value="Logoff">
|
||||
</form></div>
|
||||
<div class="container">
|
||||
<h1>Encoding</h1>
|
||||
<p>Uploaded <b>'.$upload.'</b></p>');
|
||||
if(preg_match('/20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]/', $date)===false){
|
||||
Back('Date somehow incorrect: '.$date);
|
||||
}
|
||||
if(preg_match('/[0-2][0-9]:[0-6][0-9]/', $time)===false){
|
||||
Back('Time somehow incorrect: '.$time);
|
||||
}
|
||||
$now=date('Y-m-dHi');
|
||||
if(strcmp($now, $date.$tme)>=0){
|
||||
Back('Scheduling '.$now.' in the past: '.$date.' '.$time);
|
||||
}
|
||||
$nextyear=date('Y-m-dHi', strtotime('+1 year'));
|
||||
if(strcmp($nextyear, $date.$tme)<0){
|
||||
Back('Scheduling too far into the future: '.$date.' '.$time);
|
||||
}
|
||||
if($_FILES['file']['error']!=UPLOAD_ERR_OK){
|
||||
Back('Error uploading the file');
|
||||
}
|
||||
if(!move_uploaded_file($_FILES['file']['tmp_name'], $file)){
|
||||
Back('Error moving the file');
|
||||
}
|
||||
|
||||
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>
|
||||
<p>Streaming on <b>'.$date.'</b> at <b>'.$time.'</b>h on <b>'.$target.'</b></p>');
|
||||
Back('');
|
||||
?>
|
||||
Reference in new issue
Block a user