download.php
来自「在其中你可以随意下载你所需要的文件」· PHP 代码 · 共 29 行
PHP
29 行
<?php
require 'config.php';
require 'db.php';
$db=new db;
$db->connect($dbhost, $dbuser, $dbpwd, $dbname);
$ref=$_POST['ref'];
$res=$db->query("select count(*) from list where code='".$ref."'");
$count=$db->fetch_row($res);
if(!$count[0])
{echo "no such file";}
else
{
$sql="select file from list where code='".$ref."'";
$res=$db->query($sql);
$tmp=$db->fetch_row($res);
$filename=$uploaddir.$tmp[0];
$realname=substr($tmp[0],0,-5);
$str='Content-Disposition: attachment; filename="'.$realname.'"';
header("Content-type: application/force-download");
header($str);
readfile($filename);
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?