diff options
| author | moehm | 2014-09-14 21:42:16 +0200 |
|---|---|---|
| committer | moehm | 2014-09-14 21:42:16 +0200 |
| commit | 8fcfc80ca2bb393a1a4b7d4cd16e1186b7ae3597 (patch) | |
| tree | 98f363333bb8b416eebb5460d4cf087bfaff2a5e /ajax.php | |
| parent | f4c4a9791a90c51b1699d5d178199318a2ca2a85 (diff) | |
| download | video-dl-8fcfc80ca2bb393a1a4b7d4cd16e1186b7ae3597.tar.gz | |
corrected ajax filesize check
Diffstat (limited to 'ajax.php')
| -rw-r--r-- | ajax.php | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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; |
