Free upload voting system with multiple user files without database (1)

Source: Internet
Author: User
Tags explode fread php and rar split trim zip
This is my recently developed a set of upload voting integration System, a total of 4 PHP and a number of record files, this is the first view.php, mainly responsible for the display of file lists and uploaded file forms and file names of the test. The addresses are all real addresses, please modify them as appropriate, I will provide specific usage in the last 1 articles.


<link rel= "stylesheet" href= ". /css/eccct.css ">

<body>
<center>
<script src=http://home.classover.com/~vampirehunter/js/menu.js></script>
<script>


function Opennewwin (URL) {

window.open (Url,null, "Height=200,width=200,status=no,toolbar=no,menubar=no,location=no");

}


function Check (theform) {
var tempstr=theform.upfile.value.split ("\");

var files=tempstr[tempstr.length-1].split (".");

if (theform.writer.value== "| | | theform.upfile.value==" ") {alert (" author and filename cannot be empty "); event.returnvalue= false;

if (Escape (Tempstr[tempstr.length-1]). IndexOf ("%u")!=-1) {
Alert ("File name cannot be Chinese");
Event.returnvalue= false;


}


if (files.length<2 | | (files[1]!= "rar" && files[1]!= "zip")) {
Alert ("FileName must end with lowercase zip or rar");
Event.returnvalue= false;
}

}
</script>

<body>


<?php
Col for columns, when there is $uploadto/$col. if (record title), $col. IP, $col. IPD, $col. LST Time 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/";//This PHP location
$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 "<table class=tb cellspacing=0 cellpadding=0 ><tr><td colspan=10><br><br>< Center>echo "<td width=25%> altogether". (sizeof ($info)-1). " Works </td> ";

echo "<td width=25%>". $page. " /". $maxpage." Page </td> ";
echo "<td width=25%>";
if ($page +1<= $maxpage)
echo "<a href= ' view.php?col=". $col. " &page= ". ($page + 1). "' > next page </a> ";

echo "</td>";
echo "<td width=25%>";
if ($page -1>0)
echo "<a href= ' view.php?col=". $col. " &page= ". ($page-1). "' > Prev </a> ";
echo "</td>";
echo "</tr></table><br><br>";
$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 "<table class= ' TB ' border=1 cellspacing=0 cellpadding=0>";
echo "&LT;TR&GT;&LT;TD width=16.5% class=items> number </td>";

echo "<td width=16.5% class=values>". $items [0]. " </td> ";
if (!trim ($items [1])) $items [1]= "Kill me Nor say";
echo "<td width=16.5% class=items> author </td><td width=16.5% class=values>". $items [1]. " </td> ";
$temp =sprintf ("%d", Trim ($items [5])/1024);
echo "&LT;TD width=16.5% class=items> filename </td><td class=values>". Trim ($items [2]). " (". $temp." KB) </td> ";
echo "</tr><tr>";


echo "&LT;TD class=items> the number of votes </td><td class=values >". $items [3]. " </td> ";
echo "<td class=items> download Count </td><td class=values width=13%>". $items [6]. " </td> ";

$click = "Opennewwin" ("download.php?num=". $items [0]. " &col= ". $col." "); return false; ";


$ev = "<td class=values><input type= ' button ' value= download onclick= '". $click. "' ></td> ";
Echo $ev;



echo "<td class=values><a href= ' vote2.php?col=". $col. " &option= ". $items [0]." ' > I want to vote </a></td></tr> ';



if (!trim ($items [4])) $items [4]= "Confidential";
echo "&LT;TR&GT;&LT;TD class=items> profile </td><td class=values colspan=10>". $items [4]. " </td></tr> ";
echo "</table><br><br>";

}

?>
<form method= "POST" action= "upload.php" enctype= "Multipart/form-data" >


<table CLASS=TB border=1>
<tr><td><center><tr><td>
Author: <input type= "text" name= "writer" ></td></tr>
<tr><td> Introduction: <textarea name= "Intro" style= "Width:600;overflow:hidden" >
</TEXTAREA>
</td></tr>
<tr><td> <input type=hidden name=col value= " echo $col?> ">
File: <input type= "file" name= "Upfile" > (file name Please do not include Chinese, file is less than 1MB, end with Zip,rar) </td></tr>
&LT;TR&GT;&LT;TD align= "center" > <input type= "Submission" name= "submit" value= "submitted" >


</td></tr>
</table>
</form>
</center>
</body>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.