<?php
### image.php ###
// sends an image file (.jpg, .gif, .bmp, etc...) from the Brunhilde
// Directory Tree upon request
include("global.php");
// fixes bugs assosiated with extra slashes from rawurlencoding filenames
$image = stripslashes(rawurldecode($image));
// These lines are ESSENTIAL for the brunhilde server remain secure
// They keep a client from entering "../" to gain access to files
// outside of your web tree
if((substr_count($image, "../") > 0) || (substr_count($image, "..\\") > 0)) {
include("security.php");
}
// gets the filepath
$file_path = $MEDIA_DIR[$base][1].$cdir.$image;
// gets the size of the file
$file_size = filesize($file_path);
// sends header information (mime-type etc... )
header("Content-Type: image/jpg");
header("Content-Disposition: filename=$image");
header("Content-Length: $file_size");
// outputs the contents of the file
readfile($file_path);
exit;
?>