www.gusucode.com > ECND带提取码的网络硬盘 0.1.0 For Discuz!码程序 > upfiles/links.php

    <?php
	/*
		[Yisde!] (C)2008 Comsenz Inc.
	
   		$Author: Dexter.Xia $
   		$E-Mail: 1164066@qq.com $
   		$Wedpage: http://bbs.yisde.com/forum-22-1.html $
   		$Blog: http://home.yisde.net/space.php?uid=1 $
   		$Date: 2008/7/2 13:20 $
	*/
	require_once './include/common.inc.php';
	require_once './plugins/codeup/config.php';
	$text=implode(",",$type);
	$filesize=round($size/1024,2);
	$sizem=round($filesize/1024,2);
	$code=$_GET["code"];
	$aql=$db->query("select * from cdb_list where code='".$code."'");
	$sj = $db->fetch_array($aql);
	if($code==""){$kai1=1;}
	if($sj["downloads"]==""){$kai2=1;}
	
	if($submit=="下载文件"){
	$Yisde=$_POST['Yisde'];
	$res=$db->query("select count(*) from cdb_list where code='".$Yisde."'");
	$count=$db->fetch_row($res);
	if(!$count[0])
	{
	showmessage('没有这个提取码。','links.php');
	}
	else
	{
		$sql="select file from cdb_list where code='".$Yisde."'";
		$content = $db->query("select contents from cdb_list where code='".$Yisde."'"); 
		$down = $db->query("select downloads from cdb_list where code='".$Yisde."'"); 
		$res=$db->query($sql);
		$tmp=$db->fetch_row($res);
		$contents=$db->fetch_row($content);
		$downs=$db->fetch_row($down);
		$downloads=round($downs[0]+1);
		$sqldown="update cdb_list set downloads='".$downloads."' where code='".$Yisde."'";
	if($db->query($sqldown))
		{
		$filename=$uploaddir.$contents[0].'/'.$tmp[0];
		$realname=substr($tmp[0],0,-6);
	if(file_exists("$filename"))
	{
		$str='Content-Disposition: attachment; filename="'.$realname.'"';
		header("Content-type: application/force-download");
		header($str);
  		readfile($filename);
	}
	else
	{
	showmessage('文件丢失,请联系管理员!', 'links.php');
	}
	}
	else
	{
	showmessage('数据写入错误,请联系管理员!', 'links.php');
	}
	}
	}
include template('codelinks');
?>