Publishing the page can only be done when the user is logged in, so you need to check whether you are logged in first, and then allow voting to be posted after confirmation
注意:一旦发布将不能修改!
=$min && $vname!=""){ for($i=1;$i<$itemcount;$i++){ $j=$i+1; $item=$item.'*'.@$_POST[$j]; $num=$num.'*0'; } $sql3="SELECT uid FROM users WHERE username='$ouser'"; $getVid=mysql_query($sql3); $row=mysql_fetch_row($getVid); $uid=$row[0]; $sql="insert into vote(vname,starttime,uid,vintro,open,more,max,min) value('$vname','$starttime','$uid','$vintro','$open','$more','$max','$min')"; mysql_query($sql); $sql2="SELECT vid FROM vote WHERE vname='$vname'"; $getVid=mysql_query($sql2); $row=mysql_fetch_row($getVid); $vid=$row[0]; $sql4="insert into votetitle(vid,itemcount,item,num) value('$vid','$itemcount','$item','$num')"; mysql_query($sql4); echo ""; } else{ echo ""; } }else{ echo ""; } } ?>
$ouser=@$_GET['user']; if($ouser != ''){
$time=time(); $starttime=date("y-m-d",$time);
$item=@$_POST[1]; $num=0; if($max>=$min && $vname!=""){ for($i=1;$i<$itemcount;$i++){ $j=$i+1; $item=$item.'*'.@$_POST[$j]; $num=$num.'*0'; }
Example: "Option 1*Option 2*Option 3"
(2) Default initial voting statistics, all items are 0.
Example: "0*0*0"
(3) This loop statement is actually unnecessary. PHP provides special methods to integrate and decompose arrays into strings (explode and implode), but in When I completed this part of the code, I didn't know the application of this method, so I completed this function myself.
The above introduces the simple online voting system PHP - publishing the voting page, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.