<?php
define ('ROOT', $_SERVER['DOCUMENT_ROOT'].'/');
if (isset($_GET['size']) && $_GET['size'] == 'big')
$size = 144;
else
$size = 64;
if (!empty($_GET['path'])) {
$path = realpath(ROOT.'files/video/'.$_GET['path']);
if (strpos($path, ROOT.'files/video')!==0 || !file_exists($path))
exit;
$path = str_replace(ROOT.'files/video/', null, $path);
$path = str_replace(ROOT.'files/video', null, $path);
}
else
exit('get path not found');
$tmp = 'files/video/'.$path.'/screen--'.$size.'.jpeg';
if (is_file(ROOT.$tmp)) {
header("Location: /$tmp");
exit;
}
else {
include (ROOT.'system/kernel/mysqli.php');
function __autoload($name) { include(ROOT.'system/class/'.$name.'.php'); }
$path = $DB -> query('SELECT `path` FROM `video` WHERE `path` LIKE "'.$DB -> real_escape_string($path).'/%" AND `type` = "3" ') -> fetch_array();
$path = 'files/video/'.$path['path'];
$FFimg = new create_ffimg(ROOT.$tmp, $size);
if ($FFimg->generator(ROOT.$path)) {
header("Location: /$tmp");
exit;
} else {
exit('not found');
}
}
?>