This is the download. php of the system. It is mainly responsible for downloading and recording data. The file format is described in the annotations.
<HTML>
<? PHP
// Input num as the file number to be downloaded, Col = column to be downloaded
// Ip address no-Timeout download count plus one
// File Format
// 0 No. <1 author <2 file location <3 Voting count <4 Introduction <5 File Size <6 file downloads
// Ip file format address: Project: Time
$ Uploadto = "../uploadfile/". $ Col. "/"; // subdirectory to which the file is uploaded
$ Cgiroot = "http://eccct.51.net/cgi-bin/"; // Add the current directory to the host
$ Pathtemp = explode ("/", $ http_env_vars ["path_info"]);
$ Pathtemp [sizeof ($ pathtemp)-1] = "";
$ Cgiroot = "http: //". $ http_host.implode ("/", $ pathtemp); // Add the current directory to the host
$ Ipfile = $ uploadto. $ Col. ". IPD"; // download the IP Address File
$ Overtime = 4; // timeout hour
$ Goback = "<br> <center> the system returns results in 3 seconds .... </center> <SCRIPT> setTimeout ('location. href = "view. PHP? Col = ". $ Col." "', 3000) </SCRIPT> ";
$ Recfile = $ uploadto. $ Col. ". lst ";
// Retrieve the IP File
$ Fp = @ fopen ($ ipfile, "R") or die ("sorry, this vote is invalid". $ Goback );
$ Ipinfo = fread ($ FP, filesize ($ ipfile ));
Fclose ($ FP );
Unlink ($ ipfile );
$ Times = getdate ();
$ Abstime = $ Times ["yday"]. sprintf ("% 02d", $ Times ["hours"]);
// Absolute time
// Remove the expired IP Address
$ Ip_times = explode ("|", $ ipinfo );
$ Temp = "";
$ Ipinfo = "";
For ($ I = 0; $ I <sizeof ($ ip_times); $ 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". $ Goback );
Fwrite ($ FP, $ ipinfo );
Fclose ($ FP );
$ Firstdown = 0; // The first download
}
Else {
$ Firstdown = 1; // not the first download
$ Ipinfo = $ ipinfo. $ remote_addr. ":". $ num. ":". $ abstime. "| ";
$ Fp = @ fopen ($ ipfile, "W") or die ("error". $ Goback );
Fwrite ($ FP, $ ipinfo );
Fclose ($ FP );
}
// Ip end judgment
For ($ I = 0; $ I <100 &&! File_exists ($ recfile); $ I ++ );
If ($ I = 99) Die ("system error 00". $ Goback );
$ Fp = @ fopen ($ recfile, "R") or die ("Sorry invalid". $ Goback );
$ Info = explode (">", fread ($ FP, filesize ($ recfile )));
Fclose ($ FP );
Copy ($ recfile, $ recfile. ". Bak ");
Unlink ($ recfile );
For ($ I = 0; $ I <sizeof ($ info); $ I ++ ){
$ Items = explode ("<", $ info [$ I]);
If (! Trim ($ items [0]) continue;
If (TRIM ($ items [0]) = $ num) {// The project to be downloaded
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 02". $ Goback );
}
For ($ I = 0; $ I <sizeof ($ info); $ I ++ ){
If (TRIM ($ info [$ I])! = "") Fputs ($ FP, trim ($ info [$ I]. "> "));
}
Fclose ($ FP );
Echo "Echo "<LINK rel = 'stylesheet 'href = '../CSS/eccct.css'> Echo "<body class = Tb> ";
Echo "<div> ";
Echo "<br> ";
Echo "<Div class = 'values'> your browser will automatically download it three seconds later </div> ";
Echo "<br> ";
Echo "<Div class = 'values'> or click <a href = '". $ filepath. "'> here </a> to download </div> ";
Echo "<br> ";
Echo "</div> ";
// Echo $ http_env_vars ["path_info"];
// Echo "<SCRIPT> window. Location. href = '". $ filepath. "'; window. Close (); </SCRIPT> ";
Echo "</body> ";
// Header ("Content-Type: Application/. rar ");
// Header ("content-Disposition: attachment; filename =". $ filepath );
// Header ("Location:". $ filepath );
// Header ("content-Description: php3 generated data
?>
</Html>