<?php 
require "../Run.php";
require "../include/getsize.fun.php";
	$result = mysql_query("SELECT fileid,siteid,gro,title,file_path,file_ver,file_time,file_end,file_content,file_v,file_down,file_pic,file_auter,file_lan,file_pt,spic,shenhe FROM download WHERE siteid='{$wapid}' AND gro='{$_GET['cid']}' AND fileid='{$_GET['id']}'");  
			if($result && mysql_num_rows($result) > 0){
			list($fileid,$siteid,$gro,$title,$file_path,$file_ver,$file_time,$file_end,$file_content,$file_v,$file_down,$file_pic,$file_auter,$file_lan,$file_pt,$spic,$shenhe) = mysql_fetch_row($result);
			}	
				if($_GET['act'] == 'download'){
				header("Content-type: application/*");
				header("Accept-Ranges: bytes");
				header("Content-Disposition: attachment; filename=".$file_path);
				header("Cache-Control: must-revalidate, post-check=0, pre-check=0" );
				header("Pragma: no-cache" );
				header("Expires: 0" );
				readfile($file_path);
				$dn  = $file_down + 1;
				$sql="UPDATE download SET file_down ='{$dn}' WHERE fileid='{$_GET['id']}'";
				mysql_query($sql);
				exit();
				}else{
				echo head($title);
				$html.='<style>.d_top{width:100%;background:#efefef;}
				.d_download{width:80px;}
				.d_download a{ color:#fff;font-size:16px;float:left;height:50px;line-height:50px;width:50px;margin:15px;text-align:center;background-color:#328cc9;}</style>';
				$html.='<table class="d_top" border="0" cellpadding="0" cellspacing="0"><tr><td style="width:80px;height:80px">';
				$html.='<img src="'.$spic.'" style="height:70px;width:70px;margin:5px;-webkit-border-radius:5px ;
	 -moz-border-radius:5px;"></td><td>';
				$html.='<div class="d_title">'.$title.'</div><div clas="d_ver"></div></td>';
				$html.='<td class="d_download"><a href="?act=download&cid='.$_GET['cid'].'&id='.$_GET['id'].'">下载</a></td></tr></table>';
				$html.='<div class="content">';
				$html.='[语言]'.$file_lan.'<br>';
				$html.='[平台]'.$file_pt.'<br>';
				$html.='[作者]'.$file_auter.'<br>';
				$html.='[版本]'.$file_ver.'<br>';
				$html.='[上传时间]'.date("Y/m/d H:i:s",$file_time).'<br>';
				$html.='[更新时间]'.$file_end.'<br>';
				$html.='[文件简介]<br>'.UBB($file_content).'<br>';
				$fileurl = explode("|",$file_path);
				foreach($fileurl as $value)
				{
					$html.='[文件大小]<br>'.getFileSize($value).'<br>';
					$html.='[下载地址]<br><a href="?act=download&cid='.$_GET['cid'].'&id='.$_GET['id'].'">立即下载(下载'.$file_down.'次)</a><br>';
				}
				$html.='</div>';
				$html.='<div class="mylink"><a href="http://'.HTTP_HOST.'/download/list.php?cid='.$_GET['cid'].'">返回列表</a><a href="http://'.HTTP_HOST.'/index.php?">返回首页</a></div>';
				}
	echo $html;
	echo footer(1);
?>