<?
//thumbimg
include "config.inc.php";
$refer = $_SERVER[HTTP_REFERER];
//$refer = "http://www.sebaobei.com";
$check="http://www.sebaobei.com";
$id=$_GET[id];
$type=$_GET[type];
if(eregi("^$check",$refer)){
	if($type=="img"){
	$sql="select img as img from ".$PlusDB->prefix(articles)." where id=$id";
	}else{
	$sql="select image as img from ".$PlusDB->prefix(images)." where id=$id";
	}
	//trace($sql);
	$row=$PlusDB->query_firstrow($sql);
	$url=$row[img];
	if(!file_exists($url)) $url="images/none.gif";
	header("Content-type: IMAGE/JPEG");
	header("Content-disposition: attachment; filename=thumb.jpg");
	readfile($url);
}else{
	header("Content-type: IMAGE/JPEG");
	header("Content-disposition: attachment; filename=thumb.jpg");
	readfile("images/none.gif");
}
?>