This script uses fpassthru() to load a quicktime movie that is outside of the document root. I am using an embedded image tag to call this php script. The url looks like this.
movie.php?fileID=3
When the quicktime movie player loads the movie does not start playing. All I see is the blue broken image Q in the browser. Please look at my code and tell me why it won't load.
<?php
ob_start();
session_start();
include '../include/db.inc';
include '../include/error.inc';
include '../include/include.inc';
include '../include/generalQuery.inc';
//include '../include/databaseUpdates.inc';
set_error_handler("errorHandler");
// Open a connection to the DBMS
if (!($connection = @ mysql_pconnect($hostName,
$username,
$password)))
showerror();
if (!mysql_select_db($databaseName, $connection))
showerror();
// query the download table
generalQuery($connection, "downloads");
// get the results of the query from the session and unset the session
$result = $_SESSION['result'];
unset($_SESSION['result']);
// fetch the row
$row = @ mysql_fetch_assoc($result);
$fileDir = $row['file_path']; // supply a path name.
$fileName = $row['file_name']; // supply a file name.
$fileString = $fileDir . '/' . $fileName; // combine the path and file
// translate file name properly for Internet Explorer.
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){
$fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1);
}
// make sure the file exists before sending headers
if(!$fdl=@fopen($fileString,'r')){
die("Cannot Open File!");
}
else {
//Close the session to allow for header() to be sent
header("Content-Type: video/quicktime");
fpassthru($fdl);
// increment the download counter
//databaseUpdates(&$connection, "downloads");
}
ob_end_flush();
?>