PDA

View Full Version : Help with this php script


mrand01
11-10-2006, 05:16 PM
This script should allow me to seek an FLV file even when its set to progressive download. Problem is, our server uses ASPX, not PHP. I also don't know any PHP. If someone could just comment the document so I can figure out how to translate it, thatd be great.


<?
/*/
security improved by by TRUI
www.trui.net

Originally posted at www.flashcomguru.com

//*/


//full path to dir with video.
$path = 'C:/.../clips/';


$seekat = $_GET["position"];
$filename = htmlspecialchars($_GET["file"]);
$ext=strrchr($filename, ".");
$file = $path . $filename;


if((file_exists($file)) && ($ext==".flv") && (strlen($filename)>2) && (!eregi(basename($_SERVER['PHP_SELF']), $filename)) && (ereg('^[^./][^/]*$', $filename)))
{
header("Content-Type: video/x-flv");
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");
fseek($fh, $seekat);
while (!feof($fh)) {
print (fread($fh, filesize($file)));
}
fclose($fh);
}
else
{
print("ERORR: The file does not exist"); }
?>

bigalc
11-14-2006, 08:20 AM
Your best bet is just to look up each function name on http://uk2.php.net/search.php

This is a great site and will tell you everything you need to know, with user comments and examples.

Just in case you're not aware, anything with a $ in front is a variable, not a function, except for words with a $_ in front (such as $_GET), which are like pre-defined arrays that hold information sent from other pages.

Hope this is some help.