📄 postvote.asp
字号:
<!-- #include file="setup.asp" -->
<%
id=int(Request("id"))
if Request("menu")="look" then
sql="select * from forum where id="&id&""
rs.Open sql,Conn,1
content=""&content&"<table width='100%'><tr><td width='40%'><table>"
vote=split(rs("polltopic"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22 valign=bottom>"&i+1&"."&vote(i)&"</td></tr>"
end if
next
content=""&content&"</table></td><td><table width=60>"
allticket=0
vote=split(rs("pollresult"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22 valign=bottom>票数:"&vote(i)&"</td></tr>"
allticket=vote(i)+allticket
end if
next
content=""&content&"</table></td><td><table>"
vote=split(rs("pollresult"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" and allticket<>0 then
content=""&content&"<tr><td height=22 valign=bottom><img src=images/bar/0.gif width="&vote(i)/allticket*100&" height=10> ["&formatnumber(vote(i)/allticket*100)&"%]</td></tr>"
end if
next
content=""&content&"</table></td></tr></table>"
%>
<title><%=rs("topic")%></title>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF" class="a2">
<tr class="a1">
<td height="23" align="center"><b><%=rs("topic")%></b></td>
</tr>
<tr>
<td align="left" valign="top" class="a3">
<%=content%></td></tr>
<tr>
<td align="left" valign="top" class="a4">
最近投票用户名单:<%=Application(CacheName&"vote"&id&"")%>
</td></tr>
</table>
<%
Rs.Close
responseend
end if
if Request.Cookies("username")=empty then error2("您必须登录后才能投票")
if Request("postvote")="" then error2("请选择,您要投票的项目!")
if instr(Application(CacheName&"vote"&id&""),""&Request.Cookies("username")&" ")>0 or instr(Request.Cookies("vote"),""&id&"|")>0 then error2("您已经投过票了,无需重复投票!")
if instr(Application(CacheName&"voteip"&id&""),""&Request.ServerVariables("REMOTE_ADDR")&" ")>0 then error2("此IP已经投过票了,不能重复投票!")
if Conn.Execute("Select locktopic From [forum] where ID="&id&"")(0)=1 then error("<li>此主题已经关闭,不接受新的投票")
sql="select * from forum where id="&id&""
rs.Open sql,Conn,1,3
for each ho in request.form("postvote")
pollresult=split(rs("pollresult"),"|")
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("pollresult")=allpollresult
rs("lastname")=Request.Cookies("username")
rs("lasttime")=now()
rs.update
allpollresult=""
next
rs.close
Application(CacheName&"vote"&id&"")=""&Request.Cookies("username")&" "&Application(CacheName&"vote"&id&"")&""
Application(CacheName&"voteip"&id&"")=""&Request.ServerVariables("REMOTE_ADDR")&" "&Application(CacheName&"voteip"&id&"")&""
Response.Cookies("vote")=""&Request.Cookies("vote")&""&id&"|"
Response.Cookies("vote").Expires=date+1
error2("投票成功!")
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -