我在活动模式下使用Filezilla上传到我的网站之前,检查了.iso文件的MD5sum。 MD5sum是在网站上计算得出的,并且与上传之前计算出的结果一致。如果我使用以下代码从网站下载相同的文件,则MD5sum会有所不同。
<?php
$php_scripts = '../../php/';
require $php_scripts . 'PDO_Connection_Select.php';
require $php_scripts . 'GetUserIpAddr.php';
function mydloader($l_filename=NULL)
{
$ip = GetUserIpAddr();
if (!$pdo = PDOConnect("foxclone"))
{
echo "Failed to connect to database" ;
exit;
}
if( isset( $l_filename ) ) {
// var_dump($ip,$l_filename);
$stmt = $pdo->prepare("INSERT INTO download (IP_ADDRESS, FILENAME) VALUES (?, ?)");
$stmt->execute([$ip, $l_filename]) ;
header('Content-Type: octet-stream');
header("Content-Disposition: attachment; filename={$l_filename}");
header('Pragma: no-cache');
header('Expires: 0');
readfile($l_filename);
echo "Made it here";
}
else {
echo "isset failed";
}
}
mydloader($_GET["f"]);
为什么会这样?
编辑:我通过在原子编辑器中打开原始iso和下载的iso找到了区别。下载的版本将以下内容添加到文件的开头:
herestring(14) “xx.xxx.xxx.xxx” <— my ip
string(17) “foxclone35-02.iso”
herestring(14) “xx.xxx.xxx.xxx”
string(17) “foxclone35-02.iso”
通过删除一些已添加到下载文件中的调试代码来解决。