<?
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/start.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/sess.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/home.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/settings.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/db_connect.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/ipua.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/fnc.php';

$id = (int) $_GET['id'];

$file = mysql_fetch_assoc(query("SELECT * FROM `obmennik_files` WHERE `id` = '$id'  LIMIT 1"));

if (!$file['id']) 
{
	die('Файл не найден');
	exit;
}

if (isset($_GET['video']))
{
	if ($_GET['video'] == 'convert')
	{
		$input = H.'sys/obmen/files/' . $file['id'] . '.dat';
		$outflv = H.'sys/obmen/video/' . $file['id'] . '.flv';
		
		echo '<b style="color:red">Кодирование видео..</b><br />';
		exec("ffmpeg -i $input -ar 22050 -ab 64k -f flv -r 25 -b 92k $outflv");
		
		?>
		<script language="JavaScript"> 
		  window.location.href = ""
		</script>
		<?
		exit;
	}
}
