Multi-user files without databases are freely uploaded to the voting system (2) This is the download. php of the system, which is mainly responsible for downloading and recording. the file format is described in the notes.
// 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 ="
The system will return in 3 seconds .... 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
$ 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
$ 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 If (trim ($ info [$ I])! = "") Fputs ($ fp, trim ($ info [$ I]. "> "));
}
Fclose ($ fp );
Echo" ";
Echo" ";
Echo"";
Echo"
";
Echo"
";
Echo"
Your browser will automatically download in three seconds
";
Echo"
";
Echo"
Or click here to download
";
Echo"
";
Echo"
";
// Echo $ HTTP_ENV_VARS ["PATH_INFO"];
// Echo "script window. location. href = '". $ filepath. "'; window. close (); script";
Echo"";
// Header ("Content-type: application/. rar ");
// Header ("Content-Disposition: attachment; filename =". $ filepath );
// Header ("Location:". $ filepath );
// Header ("Content-Description: PHP3 Generated Data
?>