<?php
	require_once( $_SERVER["DOCUMENT_ROOT"] . "/local.config.inc.php" );
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
	header("Cache-Control: no-store, no-cache, must-revalidate"); 
	header("Cache-Control: post-check=0, pre-check=0", false); 
	header("Pragma: no-cache"); 
	$seekat = (isset($_GET["position"])) ? $_GET["position"] : 0;
	$file = $GLOBALS["site_root"] . $_GET["file"];
	header("Content-Type: video/x-flv");
	header('Content-Length: ' . filesize($file));
	if($seekat != 0) {
		print("FLV");
		print(pack('C', 1 ));
		print(pack('C', 1 ));
		print(pack('N', 9 ));
		print(pack('N', 9 ));
	}
	$fh = fopen($file, "rb") or exit("Could not open $file");
	fseek($fh, $seekat);
	while (!feof($fh)) {
		$buf = fread( $fh , 16384 );
		echo $buf;
		unset( $buf );
		flush();
		ob_flush();
	}
	fclose($fh);
?>
