📄 voteview.php
字号:
<?php
include("pwdyb.php");
include("connect.inc.php");
include("char.inc.php");
$poll_resultBarHeight = 12; // height in pixels of percentage bar in result table
$poll_resultBarScale = 1; // scale of result bar (in multiples of 100 pixels)
$poll_resultBarFile = "phpPollBar.gif"; // name of the image that contains the bar
$poll_voteValid = 1;
$poll_IPLocking = 1;
if($poll_IPLocking == 1)
{
$poll_result = mysql_query("SELECT * FROM pollsip",$conn);
if(!$poll_result){
echo mysql_errno(). ": ".mysql_error(). "<br>";
exit();
}
$current_time = time();
while ($pollarray=mysql_fetch_array($poll_result))
{
if(($pollarray["timestamp"] + 600) < $current_time)@mysql_query("DELETE FROM pollsip WHERE timestamp=".$pollarray["timestamp"],$conn);//删除所有已经过时的IP地址
}
$poll_result = mysql_query("SELECT * FROM pollsip WHERE (votersip='$REMOTE_ADDR') AND (pollid=$pollid)",$conn);
$recordcount = mysql_num_rows($poll_result);
if($recordcount==0) @mysql_query("INSERT INTO pollsip (pollid, voteid, votersip, timestamp) VALUES ($pollid, $pollvoteid, '$REMOTE_ADDR', $current_time)",$conn);
else $poll_voteValid = 0;
}
if($poll_voteValid == 1)
{
$poll_result = mysql_query("UPDATE pollsdata SET optioncount=optioncount+1 WHERE (pollid=$pollid) AND (voteid=$pollvoteid)",$conn);
if(!$poll_result)
{
echo mysql_errno(). ": ".mysql_error(). "<br>";
exit();
}
if($poll_logging == 1)
{
$current_time = time();
$poll_result = mysql_query("INSERT INTO pollslog (pollid, voteid, votersid, timestamp) VALUES ($pollid, $pollvoteid, '$REMOTE_ADDR', $current_time)",$conn);
if(!$poll_result)
{
echo mysql_errno(). ": #2".mysql_error(). "<br>";
exit();
}
}
}
?>
<html>
<head>
<title>::::集中营调查系统::::</title>
<style type="text/css">
<!--
td{font-size:12px;line-height:17px;}
a:active {text-decoration: none;}
a:link {text-decoration: none;}
a:hover{text-decoration: underline;}
a:visited {text-decoration: none;}
BODY{font-size:12px;line-height:17px;SCROLLBAR-FACE-COLOR: #83d160; SCROLLBAR-HIGHLIGHT-COLOR: #CCFF00; SCROLLBAR-SHADOW-COLOR: #CCFF00; SCROLLBAR-3DLIGHT-COLOR: #009900; SCROLLBAR-ARROW-COLOR: #006600; SCROLLBAR-TRACK-COLOR: ##99FF00; SCROLLBAR-DARKSHADOW-COLOR: #009900; }
-->
</style>
</head>
<body bgcolor="#dcf6ce" marginwidth="0" marginheight="0" text="#666600" link="#009900" alink="#00FF00" vlink="#006600">
<?php
$votequery=@mysql_query("select * from polls where pollid=".$pollid,$conn)or die(mysql_error());
$titlearray=mysql_fetch_array($votequery);
$title=$titlearray["polltitle"];
?>
<div align="center">查看投票结果</div>
<div align="center">标题:<?php echo $title;?></div><hr noshade size="1" width="100%" color="#00CC00">
<?php
$poll_result = mysql_query("SELECT SUM(optioncount) AS SUM FROM pollsdata WHERE pollid=$pollid",$conn);
if(!$poll_result)echo mysql_errno(). ": ".mysql_error(). "<br>";
$poll_sum = (int)mysql_result($poll_result, 0, "SUM");
echo '<table border=0 bordercolorlight="#009900" bordercolordark="#009900" cellspacing="1">';
$poll_result = mysql_query("SELECT * FROM pollsdata WHERE pollid=$pollid ORDER BY voteid",$conn);
if(!$poll_result)echo mysql_errno(). ": ".mysql_error(). "<br>";
while ($textarray=mysql_fetch_array($poll_result)){
echo "<tr><td width=\"130\"><div align=\"right\">".$textarray["optiontext"]."</div></td>";
if($poll_sum) $poll_percent=100*$textarray["optioncount"]/$poll_sum;
else $poll_percent=0;
echo '<td width="102">';
if ($poll_percent > 0){
$poll_percentscale = (int)($poll_percent * $poll_resultBarScale);
echo "<img src=\"images/phppollbar".$textarray["voteid"].".gif\" height=$poll_resultBarHeight width=$poll_percentscale>";
}else{
echo " ";
}
echo '</td><td width="100">';
printf(" %.2f %% (%d票)", $poll_percent, $textarray["optioncount"]);
echo '</td></tr>';
}
echo '<tr><td width="130"> </td><td width="102"> </td><td width="100">共计: <font color="#FF0000"><b>'.$poll_sum.'</b></font> 票</td></tr></table>';
?>
<hr noshade size="1" width="100%" color="#00CC00">
<div align="center"><a href="javascript:window.close()">关闭窗口</a></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -