📄 postvote.asp
字号:
<!-- #include file="Cls.asp" -->
<%
if Not IsUser then GoErr("错误:您必须登录后才能投票")
id=ChkNumeric(Request("id"))
if Request("PostVote")=Empty then CloseDataBase
sql="select * from [WxVote] where ThreadID="&id&""
Rs.Open sql,Conn,1,3
if instr("|"&Rs("BallotUserList")&"|","|"&CookieUserName&"|")>0 then CloseDataBase
if instr("|"&Rs("BallotIPList")&"|","|"&Request.ServerVariables("REMOTE_ADDR")&"|")>0 then CloseDataBase
if Rs("Expiry")< now() then CloseDataBase
for each ho in Request("PostVote")
pollresult=split(Rs("Result"),"|")
for i = 0 to UBound(pollresult)
if Not pollresult(i)="" then
if cint(ho)=i then
pollresult(i)=pollresult(i)+1
end if
allpollresult=""&allpollresult&""&pollresult(i)&"|"
end if
next
Rs("Result")=allpollresult
Rs.update
allpollresult=""
next
Rs("BallotUserList")=""&Rs("BallotUserList")&""&CookieUserName&"|"
Rs("BallotIPList")=""&Rs("BallotIPList")&""&Request.ServerVariables("REMOTE_ADDR")&"|"
Rs.update
Rs.close
Conn.Execute("update [WxThreads] set lasttime="&SqlNowString&",lastname='"&CookieUserName&"' where id="&id&"")
sql="select * from [WxVote] where ThreadID="&id&""
Set Rs=Conn.Execute(sql)
Expiry=Rs("Expiry")
if Rs("Type")=1 then
multiplicity="checkbox"
else
multiplicity="radio"
end if
allticket=0
Result=split(Rs("Result"),"|")
for i = 0 to UBound(Result)
if Not Result(i)="" then allticket=Result(i)+allticket
next
Vote=split(Rs("Items"),"|")
for i = 0 to UBound(Vote)
if Not Vote(i)="" then
if allticket=0 then
Voteresult=0
Votepercent=0
else
Voteresult=result(i)/allticket*100
Votepercent=FormatNumber(result(i)/allticket*100)
end if
%><div class="tc b cb">
<div class="fl r w4 h3"><input type="<%=multiplicity%>" name="PostVote" value="<%=i%>" /><%=Vote(i)%></div>
<div class="fl r w0 h3 ac"><span id="ps<%=i%>"><%=Result(i)%></span></div>
<div class="fr h3">
<div class='percent fl al' id="bar<%=i%>" style="width:300px;"><div id="per" style='width:<%=Voteresult%>%'></div></div>
<span class="fr ac" id="per<%=i%>"><%=Votepercent%>%</span>
</div>
</div>
<%
end if
next
Rs.Close
CloseDataBase
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -