blob: 6a081066bfeba8fcdc615220758e410b50c8c28d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
require_once("func.php");
if($_SERVER["REQUEST_METHOD"] != "POST")
failure("Request method not supported.", false);
if(empty($_POST["vid"]))
failure("Not found.", false);
require_once("config.php");
require_once("class/redis.php");
$id = getId($_POST["vid"]);
$db = new database($REDIS_DBNAME, $REDIS_CONNECT);
$db->open();
$vidurl = $db->getItem($id, 3);
$curl = curlInfo($vidurl);
$filesize = $curl[2];
$size = BytesHumanSize($filesize);
// 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 {
$filesize = "<p style=\"color:red\">Size: ".$size." (Error: File too large!)";
}
echo $filesize;
|