<!--#include file="../conns.asp"-->
<!--#include file="../inc/const.asp"-->
<%
Dim voteid, MyChoose, i, Rs, SQL
If Not IsObject(Conn) Then ConnectionDatabase
voteid = CLng(Request("voteid"))
If Request.Cookies("vote_"&voteid) = "newaspvote_" &voteid Then
	Response.Write("&back=已经参与过投票，谢谢")
	Response.End
Else
	Response.Cookies("vote_"&voteid) = "newaspvote_" &voteid
	Response.Cookies("vote_"&voteid).expires = Date + 3650
	Response.Cookies("vote_"&voteid).domain = Request.ServerVariables("SERVER_NAME")
	MyChoose = Split(Request("myChoose"), ",", -1, 1)
	Set Rs = server.CreateObject("adodb.recordset")
	SQL = "SELECT * FROM NC_Vote WHERE id = " &voteid
	Rs.Open SQL, Conn, 1, 3
	If Not (Rs.BOF And Rs.EOF) Then
		For i = 1 To 5
			If MyChoose(i -1) = "true" Then
				Rs("ChooseNum_"&i&"") = Rs("ChooseNum_"&i&"") + 1
			End If
		Next
		Rs.update
		For i = 1 To 5
			If MyChoose(i -1) = "true" Then
				Conn.Execute ("UPDATE NC_Vote SET VoteNum=VoteNum+1 WHERE id=" &Rs("id"))
			End If
		Next
	End If
	Rs.Close
	Set Rs = Nothing
	Response.Write("&back=投票已经送达，谢谢参与")
End If
CloseConn
%>
