This is my recent development of a set of upload voting system, a total of 4 PHP and a number of record files, which is the first view.php, is mainly responsible for displaying the file list and uploaded file form and filename of the test. Where the addresses are real addresses, please use the corresponding changes, I will provide specific usage methods in the last 1 articles.
Col is a column when there is $uploadto/$col. if (record title), $col. IP, $col. IPD, $col. LST Legal
//
Page is the first few pages 1-n
Rowperpage for a few lines per page
if (! $page) $page = 0;
$rowperpage = 5;
if (! $col) Die ("System error");
$cgiroot = "http://eccct.51.net/cgi-bin/";//Where PHP is located
$uploadto = ". /uploadfile/". $col." /";
$fp = @fopen ($uploadto. $col. ". If "," R ") or Die (" System error ");
$title =fread ($fp, FileSize ($uploadto. $col. If "));
Fclose ($FP);//$title The name of the upload
$recfile = $uploadto. $col. ". LST ";
$fp = @fopen ($recfile, "R") or Die ("System error");
$info =explode (">", Fread ($fp, FileSize ($recfile)));
Fclose ($FP);
$maxpage =ceil ((sizeof ($info)-1)/$rowperpage);
if (! $maxpage) $maxpage = 1;
if ($page > $maxpage | | $page <1) $page = 1;
echo "
". $title." |
"; echo "
Total ". (sizeof ($info)-1). " of works | "; echo "
Section ". $page." /". $maxpage." Page | "; echo "
"; if ($page +1<= $maxpage) echo "Next page"; echo " | "; echo "
"; if ($page -1>0) echo "Prev"; echo " | "; echo "
";
$startrec = ($page-1) * $rowperpage;
$endrec = $startrec + $rowperpage;
for ($i = $startrec; $i < $endrec && $info [$i]!= ""; $i + +) {
$items =explode ("<", $info [$i]);
if (!trim ($items [0])) continue;
echo "
";echo "
Number | "; echo "
". $items [0]." | "; if (!trim ($items [1])) $items [1]=] I don't say "kill me"; echo "
Author |
". $items [1]." | "; $temp =sprintf ("%d", Trim ($items [5])/1024); echo "
Filename |
". Trim ($items [2])." (". $temp." KB) | "; echo "
"; echo "
Number of votes. |
". $items [3]." | "; echo "
Number of downloads |
". $items [6]." | "; $click = "Opennewwin" ("download.php?num=". $items [0]. " &col= ". $col."); return false; "; $ev = "
I want to vote. |
"; if (!trim ($items [4])) $items [4]= "Confidential"; echo "
Brief introduction |
". $items [4]." |
"; echo "
";
}
?>
The above describes the use of the database of multi-user files free upload voting system 1, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.