summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoehm2014-09-14 21:42:16 +0200
committermoehm2014-09-14 21:42:16 +0200
commit8fcfc80ca2bb393a1a4b7d4cd16e1186b7ae3597 (patch)
tree98f363333bb8b416eebb5460d4cf087bfaff2a5e
parentf4c4a9791a90c51b1699d5d178199318a2ca2a85 (diff)
downloadvideo-dl-8fcfc80ca2bb393a1a4b7d4cd16e1186b7ae3597.tar.gz
corrected ajax filesize check
-rw-r--r--ajax.php14
-rw-r--r--dl.php3
-rw-r--r--video.php4
3 files changed, 14 insertions, 7 deletions
diff --git a/ajax.php b/ajax.php
index ed3f596..6a08106 100644
--- a/ajax.php
+++ b/ajax.php
@@ -18,15 +18,19 @@ $curl = curlInfo($vidurl);
$filesize = $curl[2];
$size = BytesHumanSize($filesize);
-if($filesize < $MAXSIZE && $filesize != 0){ /* 50M */
+// checks if the http respond code is valid or if the filesize not empty
+if ($curl[0] >= 400 || $filesize == 0){
+ $filesize = "<p style=\"color:red;\">Size: ".$size." (Error: Access forbidden!)</p>";
+ if($curl[0] >= 400)
+ header($_SERVER['SERVER_PROTOCOL'] . " $curl[0] forbidden");
+} else if($filesize < $MAXSIZE && $filesize != 0){ /* 50M, now 200M */
$filesize = "<p style='color:green;'>Size: ".$size."</p>";
+/*
} else if($filesize < $STREAM_MAXSIZE && $filesize != 0){
$filesize = "<p style='color:red;'>Size: ".$size." (only streaming supported!)</p>";
-} else if($filesize != 0) {
- $filesize = "<p style='color:red;'>Size: ".$size." (not supported!)</p>";
+*/
} else {
- $filesize = "<p style=\"color:red;\">Size: ".$size." (Access forbidden!)</p>";
- header($_SERVER['SERVER_PROTOCOL'] . " $curl[0] forbidden");
+ $filesize = "<p style=\"color:red\">Size: ".$size." (Error: File too large!)";
}
echo $filesize;
diff --git a/dl.php b/dl.php
index ba35a1d..88d597e 100644
--- a/dl.php
+++ b/dl.php
@@ -32,6 +32,9 @@ $curl = curlInfo($info[3]);
if($_GET["task"] == "stream" || $_GET["task"] == "player")
$MAXSIZE = 200000000;
+if($_GET["ddl"])
+ $MAXSIZE = 2000000000;
+
# checks file size
if($curl[2] > $MAXSIZE){ // 50M
$f=BytesHumanSize($curl[2] - $MAXSIZE);
diff --git a/video.php b/video.php
index 38b5ca6..a56c3c1 100644
--- a/video.php
+++ b/video.php
@@ -53,11 +53,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
}
else if (task == 'size'){
document.getElementById('size').innerHTML=r.responseText;
- var result = r.responseText.match(/streaming|not/);
+ var result = r.responseText.match(/streaming|Error/);
if(result == 'streaming'){
document.getElementById('audio').className=document.getElementById('audio').className + ' disabled';
document.getElementById('download').className=document.getElementById('download').className + ' disabled';
- } else if(result == 'not'){
+ } else if(result == 'Error'){
document.getElementById('audio').className=document.getElementById('audio').className + ' disabled';
document.getElementById('download').className=document.getElementById('download').className + ' disabled';
document.getElementById('streaming').className=document.getElementById('streaming').className + ' disabled';