This is the system of download.php, mainly responsible for downloading and counting, wherein the file format is described in the comments.
Incoming num is the file number to download, col= the columns to download
IP does not timeout download count plus one
File format
0 Ref. <1 Author <2 file location <3 poll Count <4 introduction <5 file size <6 file download times
IP file Format address: Project: Time
$uploadto = ". /uploadfile/". $col." /";//Sub-directory uploaded to
$cgiroot = "http://eccct.51.net/cgi-bin/"; Host Plus current directory
$pathtemp =explode ("/", $HTTP _env_vars["Path_info"]);
$pathtemp [sizeof ($PATHTEMP) -1]= ";
$cgiroot = "http://" $HTTP _host.implode ("/", $pathtemp);//host plus current directory
$ipfile = $uploadto. $col. ". IPD ";//IP file for download
$overtime =4;//time-out hours
$goback = "
The system will return in 3 seconds .... ";
$recfile = $uploadto. $col. ". LST ";
Remove IP file
$fp = @fopen ($ipfile, "R") or Die ("I'm sorry the vote is illegal". $goback);
$ipinfo =fread ($fp, FileSize ($ipfile));
Fclose ($FP);
Unlink ($ipfile);
$times =getdate ();
$abstime = $times ["Yday"].sprintf ("%02d", $times ["hours"]);
Absolute time
Remove the timeout IP
$ip _times=explode ("|", $ipinfo);
$temp = "";
$ipinfo = "";
for ($i =0; $i
$ip =explode (":", $ip _times[$i]);
if ($ip [1]==] | | $ip [0]==] | | $ip [2]== "") continue;
Eval (' $temp = '. $abstime. '-'. $ip [2]. '; ');
if ($temp < $overtime && $temp >=0) {
$ipinfo. = ($ip _times[$i]. "|");
}
}
Echo $ipinfo;
if (Strstr ($ipinfo, $REMOTE _addr. ":". $num))
{
$fp = @fopen ($ipfile, "w") or Die ("error occurred". $goback);
Fwrite ($fp, $ipinfo);
Fclose ($FP);
$firstdown =0;//First time download
}
else{
$firstdown =1;//is not the first time to download
$ipinfo = $ipinfo. $REMOTE _addr. ":". $num. ":". $abstime. "|";
$fp = @fopen ($ipfile, "w") or Die ("error occurred". $goback);
Fwrite ($fp, $ipinfo);
Fclose ($FP);
}
IP judgment Ended
for ($i =0; $i <100 &&!file_exists ($recfile); $i + +);
if ($i ==99) die ("System error". $goback);
$fp = @fopen ($recfile, "R") or Die ("Sorry is not legal". $goback);
$info =explode (">", Fread ($fp, FileSize ($recfile)));
Fclose ($FP);
Copy ($recfile, $recfile. ". Bak ");
Unlink ($recfile);
for ($i =0; $i
$items =explode ("<", $info [$i]);
if (!trim ($items [0])) continue;
if (Trim ($items [0]) = = $num) {//items to download
if ($firstdown)
$items [6]++;
$filepath = $uploadto. $items [2];
$info [$i]=implode ("<", $items);
Break
}
}
$writetofile =implode (">", $info);
if (! $fp =fopen ($recfile, "w")) {
Copy ($votefile. ". Bak ", $votefile);
Die ("error". $goback);
}
for ($i =0; $i if (Trim ($info [$i]) = "") fputs ($fp, Trim ($info [$i]. " > "));
}
Fclose ($FP);
echo " ";
echo " ";
echo "";
echo "";
echo "
";
echo "Your browser will automatically download after three seconds";
echo "
";
echo "or click here to download";
echo "
";
echo "";
echo $HTTP _env_vars["Path_info"];
echo "";
echo "";
Header ("Content-type:application/.rar");
Header ("content-disposition:attachment; Filename= ". $filepath);
Header ("Location:". $filepath);
Header ("Content-description:php3 Generated Data
?>
http://www.bkjia.com/PHPjc/316394.html www.bkjia.com true http://www.bkjia.com/PHPjc/316394.html techarticle This is the system of download.php, mainly responsible for downloading and counting, wherein the file format is described in the comments. html? PHP//Incoming num is the file number to download, col= the column//ip to download does not time out ...