⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 download.php

📁 十大精典PHP项目开发全程案例+代码
💻 PHP
字号:
<?php
	include "conn/conn.php";
	$address = $_GET[id];
	if($_GET[action] == "audio"){
		$a_sql = "select address,downTime from tb_audio where address = '".$address."'";
		$a_rst = $conn->execute($a_sql);
		if(!$a_rst->eof){
			$downtime = array();
			$downtime["downTime"] = $a_rst->fields[1] + 1;    
			$updata = $conn->getupdateSql($a_rst,$downtime);
			$conn->execute($updata);
			$path= "upfiles/audio/".$address;
		}
	}else if($_GET[action] == "video"){
		$a_sql = "select address,downTime from tb_video where address = '".$address."'";
		$a_rst = $conn->execute($a_sql);
		if(!$a_rst->eof){
			$downtime = array();
			$downtime["downTime"] = $a_rst->fields[1] + 1;    
			$updata = $conn->getupdateSql($a_rst,$downtime);
			$conn->execute($updata);
			$path = "upfiles/video/".$address;
		}
	}
if(file_exists($path)==false)
{
 echo "<script>alert('您访问文件已删除,请与管理员联系。');history.back();</script>";
 exit;
}
$filename=basename($path);
$file=fopen($path,"r");
header("Content-type:application/octet-stream");
header("Accept-ranges:bytes");
header("Accept-length:".filesize($path));
header("Content-Disposition:attachment;filename=".$filename);
echo fread($file,filesize($path));
fclose($file);
exit;
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -