<?php
require("../includes/global.php");
$sql = "SELECT * FROM " . $dbprefix . "images WHERE imageid = " . intval($_GET["imageid"]);
$img = $db->execute($sql);
if ($img->rows < 1){ notfound(); }
// build the filetype
Header("Content-type: " . $img->fields["format"]);
echo($img->fields["imagefile"]);
?>