【php开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了php开源代码-downloadfile.php的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
<?
function Decrypt($str)
{
global $encoderText;
$seed = DecodeChar($str,0);
if (gettype($seed)!="integer")
return "";
$pre = DecodeChar($str,2);
if (gettype($pre)!="integer")
return "";
$pre = $pre&3;
$ret = "";
$len = strlen($str);
$elen = strlen($encoderText);
for ($i=$pre+$pre+4,$j=$seed;$i<$len;$i+=2)
{
$x = DecodeChar($str,$i);
if (gettype($x)!="integer")
return "";
$x ^= ord(substr($encoderText,$j,1));
$ret .= chr($x);
if (++$j>=$elen)
$j=0;
}
return $ret;
}
function DecodeChar($str,$i)
{
return intval(substr($str,$i,2),16);
}
$strFullPath=decrypt($strFullPath);
if($oldflag=="old")
{
$strFullPath= $FolderPath . "/" . $FolderType . "/" . $FileName;
}
$name=basename($strFullPath);
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description:
PHP3 Generated Data");
readfile($strFullPath);
exit();
?>