From 6bc25889b8c443db5a7f0f83f934235646258abd Mon Sep 17 00:00:00 2001 From: pepa65 Date: Sat, 17 Sep 2022 02:40:50 +0700 Subject: [PATCH] Complete date/time split --- uploadpage/index.php | 5 ++- uploadpage/page.css | 82 +++++++++++++++++++++---------------------- uploadpage/upload.php | 27 +++++++------- 3 files changed, 58 insertions(+), 56 deletions(-) diff --git a/uploadpage/index.php b/uploadpage/index.php index e20ce19..515765e 100755 --- a/uploadpage/index.php +++ b/uploadpage/index.php @@ -37,10 +37,9 @@ function filename(){ -
- -
+ +

diff --git a/uploadpage/page.css b/uploadpage/page.css index 67587b1..e0aec56 100755 --- a/uploadpage/page.css +++ b/uploadpage/page.css @@ -37,6 +37,47 @@ h4 { 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; @@ -75,15 +116,6 @@ input[type=submit] { border:none; cursor:pointer; } -::file-selector-button { - -moz-opacity:0; - filter:alpha(opacity:0); - opacity:0; -} -.fileinput { - position:relative; - max-width:fit-content(325px); -} .datetime { display:flex; flex-direction:rows; @@ -100,35 +132,3 @@ input[type=time] { padding-left:0; padding-right:0; } -#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; -} diff --git a/uploadpage/upload.php b/uploadpage/upload.php index cfb7f28..65ccabe 100755 --- a/uploadpage/upload.php +++ b/uploadpage/upload.php @@ -23,22 +23,22 @@ foreach($mh as $line){ } $upload=htmlspecialchars(basename($_FILES['file']['name'])); $key=$_POST['streamkey']; -$datetime=$_POST['datetime']; +$date=$_POST['date']; +$time=$_POST['time']; $email=$_POST['email']; $user=$_SESSION['user']; +$target=$_POST['target']; if($email){ $to=$email; $email=':'.$email; }else{ $to=$mails[$user]; } -$date=substr($datetime, 0, 10); -$hour=substr($datetime, 11, 2); -$min=substr($datetime, 14, 2); -$time=$hour.$min; -$target=$_POST['target']; +$hour=substr($time, 0, 2); +$min=substr($time, 3, 2); +$tme=$hour.$min; $dir='streams/'; -$name=$key.'.'.$date.'_'.$time.'_'.$user.$email.'@'.$target; +$name=$key.'.'.$date.'_'.$tme.'_'.$user.$email.'@'.$target; $file=$dir.$name.'.upload'; print(' @@ -51,15 +51,18 @@ print('

Encoding

Uploaded '.$upload.'

'); -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); +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.$time)>0){ +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.$time)<0){ +if(strcmp($nextyear, $date.$tme)<0){ Back('Scheduling too far into the future: '.$date.' '.$time); } if($_FILES['file']['error']!=UPLOAD_ERR_OK){ @@ -71,5 +74,5 @@ if(!move_uploaded_file($_FILES['file']['tmp_name'], $file)){ print('

Streaming '.$name.'.mp4

'); print('

When done encoding, email '.$to.'

'); -Back('Streaming on '.$date.' at '.$hour.':'.$min.'h on '.$target.''); +Back('Streaming on '.$date.' at '.$time.'h on '.$target.''); ?>