blob: ed3f596ad14c473d27fad6acb23505ed40e0145e (
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
|
<?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);
if($filesize < $MAXSIZE && $filesize != 0){ /* 50M */
$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");
}
echo $filesize;
|