十大精典PHP项目开发全程案例+代码

源代码在线查看: download.php

软件大小: 12200 K
上传用户: 吕布LOVE阙
关键词: PHP 项目 案例 代码
下载地址: 免注册下载 普通下载 VIP

相关代码

									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 "alert('您访问文件已删除,请与管理员联系。');history.back();";
				 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;
				?>			

相关资源