Proper login
This commit is contained in:
1 parent
ab0e2818c0
commit
39dc99cbd6
8 files changed
+113
-45
No files matched your search
+23
-17
@@ -1,28 +1,36 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
$headers=getallheaders();
|
||||
$authuser=$headers['X-User'];
|
||||
if($_SERVER['REQUEST_METHOD']!=='POST'){
|
||||
header('Location: /');
|
||||
<?php // Encode page
|
||||
session_start();
|
||||
require "check.php";
|
||||
if(!isset($_POST['schedule'])){ // If not post: start again
|
||||
header('Location: index.php');
|
||||
}
|
||||
|
||||
function Back($msg){
|
||||
print('<p>'.$msg.'</p>
|
||||
<form action="'.(isset($_SERVER['HTTPS']) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].'" method="post">
|
||||
<form action="index.php" method="post">
|
||||
<input type="submit" value="Upload another file" name="submit">
|
||||
</form></div>');
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
// Get mails
|
||||
$mh=file(__DIR__.'/../mailhash',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=$_POST['streamkey'];
|
||||
$datetime=$_POST['datetime'];
|
||||
$email=$_POST['email'];
|
||||
$user=$_SESSION['user'];
|
||||
if($email){
|
||||
$email='_'.$email;
|
||||
} else {
|
||||
$email='_'.$authuser;
|
||||
$to=$email;
|
||||
$email=':'.$email;
|
||||
}else{
|
||||
$to=$mails[$user];
|
||||
}
|
||||
$date=substr($datetime, 0, 10);
|
||||
$hour=substr($datetime, 11, 2);
|
||||
@@ -30,16 +38,16 @@ $min=substr($datetime, 14, 2);
|
||||
$time=$hour.$min;
|
||||
$target=$_POST['target'];
|
||||
$dir='streams/';
|
||||
$name=$key.'.'.$date.'_'.$time.$email.'@'.$target;
|
||||
$name=$key.'.'.$date.'_'.$time.'_'.$user.$email.'@'.$target;
|
||||
$file=$dir.$name.'.upload';
|
||||
print('<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Encoding</title>
|
||||
<title>Stream Upload encoding</title>
|
||||
<link rel="icon" href="favicon.png">
|
||||
<link rel="stylesheet" href="page.css">
|
||||
<div class="container">
|
||||
<h1>Encoding</h1>
|
||||
'.($authuser==='' ? '' : '<p>For: <b>'.$authuser.'</b></p>').'
|
||||
<p>For: <b>'.$user.'</b></p>
|
||||
<p>File: <b>'.$upload.'</b></p>');
|
||||
if(preg_match('/20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]/', $datetime)===false){
|
||||
Back('Date/time somehow incorrect: '.$datetime);
|
||||
@@ -60,8 +68,6 @@ if(!move_uploaded_file($_FILES['file']['tmp_name'], $file)){
|
||||
}
|
||||
|
||||
print('<p>File is now being encoded to <b>'.$name.'.mp4</b></p>');
|
||||
if($email){
|
||||
print('<p>When done, an email will be sent to <b>'.substr($email,1).'</b></p>');
|
||||
}
|
||||
print('<p>When done, an email will be sent to <b>'.$to.'</b></p>');
|
||||
Back('Scheduling for <b>'.$date.'</b> at <b>'.$hour.':'.$min.'</b>h on <b>'.$target.'</b>');
|
||||
?>
|
||||
Reference in new issue
Block a user