when a link to file is clicked by user, .htaccess shots control over to authorize.php:
want to prevent other users from snooping in private folders.
before I added the pass through authorize.php everything was working great.
session stuff was removed for troubleshooting.
// Open the file for reading
$fp = fopen($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'], 'r');
// Set mime type to header
header('Content-type: '.mime_content_type($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']));
// Send the contents of the file the browser
fpassthru($fp);
fclose($fp);
}
else {
// File not found
die('File not found'); }
} // end of IF AUTHORIZED
else {
die('Access denied');}
?>
######################################## END
mime content type results are more or less correct (doc and xls files id'ed as txt). but does spot jpg and gif correctly.
no whitespace in code.
files are not corrupt, they download just fine.
pdf and txt files display fine.
IS THIS A PROBLEM WITH HEADERS, OR CACHE STUFF, OR WHAT?
I'm really lost here and in dire need of a point in the right direction PLEASE.
Bookmarks