There's probably a simpler way to do this:
<?php
if (($File != @fopen ($_GET['File'], "br") || strpos($HTTP_REFERRER, $MySiteName) === false))
// If the file can't be opened, or the http_referrer is not from your site.
{
// Open the 'NotFound' file and change the filesize accordingly
$FileLength = filesize("Images/NotFound.gif");
$File = fopen ("Images/NotFound.gif");
// The 'notFound' file had better exist, otherwise the image will show as a red X!
}
else
{
// get the filesize of the file that we're loading
$FileLength = filesize($_GET['File']);
}
$File2 = fread($File, $FileLength);
fclose ($File);
// Get the contents of the file and then close it.
echo $File;
// print out the contents of the file.
?>
This is just something that I came up with off the top of my head to do a similar thing.
edit: this is probably riddled with errors, I didn't check anything on the PHP manual before I posted, but the comments should give you the general idea.
KITTfan2K