<!--#include file="../fuction.asp"--><!-- #include file="conn.asp" -->
<%
sub echo(message)
%><script>alert('<%=message%>');history.back();</script><script>window.close();</script>
<% response.end
end sub
%>
<%id=nosql(int(Request("id")))
if Request("menu")="look" then
list=""&Application(CacheName&"vote"&id&"")&""
if list=empty then echo("目前暂时没有记录投票的用户名单！")
echo("参与投票的用户名单：\n"&list&"")

end if
if session("username")=empty then echo("您必须登录后才能投票")
if Request("postvote")="" then echo("请选择，您要投票的项目！")
if instr(Application(CacheName&"vote"&id&""),""&session("username")&" ")>0 or instr(Request.Cookies("vote"),""&id&"|")>0 then echo("您已经投过票了，无需重复投票！")

if instr(Application(CacheName&"voteip"&id&""),""&Request.ServerVariables("REMOTE_ADDR")&" ")>0 then echo("此IP已经投过票了，不能重复投票！")

Set rs= Server.CreateObject("ADODB.Recordset") 
sql="select * from book where id="&id&""
rs.Open sql,Conn,1,3
for each ho in request.form("postvote")
vote_body=split(rs("vote_body"),"|")
for i = 0 to ubound(vote_body)
if not vote_body(i)="" then
if cint(ho)=i then
vote_body(i)=vote_body(i)+1
end if
allpollresult=""&allpollresult&""&vote_body(i)&"|"
end if
next
rs("vote_body")=allpollresult
rs.update
allpollresult=""
next
rs.close
Application(CacheName&"vote"&id&"")=""&session("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
echo("投票成功!")
%>