<?

include_once "./setting.php";
include_once $global["root"] . "/include/handle.php";
include_once $global["root"] . "/include/print_array.php";

include_once $global["root"] . "/lib/Site.php";

$Site = new Site;
$Site->init("mail");

include_once $global["lang"] . "/" . $_SESSION["config_lang"] . ".php";

extract($_GET);

$SQL_GET_DOC_FILE =
	"select SQL_CACHE realname, storedname, mime_type from doc_%s where no = '%s'";

$a = $Site->DB->fetch_one(sprintf($SQL_GET_DOC_FILE, $_SESSION["config_id"], $no));

if (! $a["size"] < 1 or !$a["realname"]) goprev();

$storedfile = $global["data"] . "/doc/" .
	$_SESSION["config_id"] . "/" . $a["storedname"];

if (! file_exists($storedfile)) goprev();

// send it.
Header("Content-type: " . $a["mime_type"]);

if ($a["realname"]) {
	$url = "Content-Disposition: inline; filename=\"" . $a["realname"] . "\"";

	$Site->end1();

	Header($url);
}

readfile($storedfile);


/*
Description
-----------

Author
------
 Spike^ekipS <spike@spikeekips.net>

Changelog
---------

Usage
-----

*/

?>
