<?
//thumbnail.php
include "config.inc.php";
$fdb = $PlusDB->prefix(attachment);
$id=$_GET[id];
$sql="select * from $fdb where id=$id";
$row=$PlusDB->query_firstrow($sql);
if(!is_array($row)){	
}else{
	//print_r($row);
	$type  = $row[ctype];
	$url = $row[url];
	$urls=explode("/",$url);
	$filename=$urls[count($urls)-1];
	$types=explode(".",$filename);
	$filetype=strtoupper($types[count($types)-1]);
	switch($type){
		case "image":
		header("Content-type: application/octet-stream");
		header("Content-disposition: attachment; filename=" . $filename);
		readfile($url);
	}
}
?>