summaryrefslogtreecommitdiff
path: root/ajax.php
diff options
context:
space:
mode:
authormoehm2014-09-14 21:42:16 +0200
committermoehm2014-09-14 21:42:16 +0200
commit8fcfc80ca2bb393a1a4b7d4cd16e1186b7ae3597 (patch)
tree98f363333bb8b416eebb5460d4cf087bfaff2a5e /ajax.php
parentf4c4a9791a90c51b1699d5d178199318a2ca2a85 (diff)
downloadvideo-dl-8fcfc80ca2bb393a1a4b7d4cd16e1186b7ae3597.tar.gz
corrected ajax filesize check
Diffstat (limited to 'ajax.php')
-rw-r--r--ajax.php14
1 files changed, 9 insertions, 5 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;