<!-- #include file="inc/conn.asp"-->
<%
if session("vote")<>"" then
response.write "<script>alert('您已经投过票了，请不要重复投票');history.back();</script>"
 response.end
end if
lanmu_id=request("lanmu_id")
if not isnumeric(lanmu_id) then
  response.Write "操作错误！"
  response.end
end if
if request.Cookies("isvoted")("voteid"&lanmu_id)=lanmu_id then
	response.write "<script>alert('您已经投过票了，请不要重复投票');history.back();</script>"
	response.end
end if

id=request.form("id")
types=request.form("types")

if id<>"" then
 select case types
 case 1 '单选
 sql="select * from vote_body where id="&id
 set rs=server.CreateObject("adodb.recordset")
 rs.open sql,conn,1,3 
 rs("counts")=rs("counts")+1
 rs.update
 rs.close
 set rs=nothing
 conn.close
 set conn=nothing
 case 2 '多选
 vvv=replace(id," ", "")
 vv=split(vvv,",") 
 for i= 0 to ubound(vv)
 conn.execute("update vote_body set counts=counts+1 where id=cint('"&vv(i)&"')")
 next 
 conn.close
 set conn=nothing
 end select
' session("vote")="投票"
 
 response.Cookies("isvoted")("voteid"&lanmu_id)=lanmu_id
 response.Cookies("isvoted").expires=dateAdd("d",1,now)

 response.write "<script>alert('投票成功');history.back();</script>"
 response.end
 

 
else
 response.write "<script>alert('投票选项不能为空');history.back();</script>"
 response.end
end if


%>