<?
include_once("inc/config.php");
include_once("inc/publicfun.php");
include_once("inc/ftbbsdbclass.php");
include_once("conn.php");
include_once("touxianfun.php");
include_once("checkuser.php");

$id=intval($_GET["id"]);
$query = "SELECT * FROM {$tablepre}ftbbsmb";
$ftbbsmb=makecache('ftbbsmb.html',$query,$expire);
$clubuser_id=get_cookie('clubuser_id');
$cookiesbz=get_cookie('bz');
$cookiesfbz=get_cookie('bbsadmin');
$downvalue=$ftbbsmb[59];
if ($downvalue==0){
$topqs=1;
}
else{
$topqs=jingyuantoqs($clubuser_id,$downvalue);
}

$sql="select upload_pic,clubuser_id from {$tablepre}ftbbs_upload where id=".$id;
$rs=mysql_query($sql);
$row = mysql_fetch_array($rs);
$uploadfile=$row["upload_pic"];
$userid=$row["clubuser_id"];
$db->close(); 
if ($topqs==1 || $clubuser_id=='".$userid."' || $cookiesbz==1 || $cookiesfbz==1){
header("Location:".$uploadfile);
}
else{
   echo "<script language='javascript'>";
   echo "alert('你的积分太少,无法下载附件!');";
   echo "history.go(-1);";
   echo "</script>";
   exit; 
}
?>