一聚教程网:一个值得你收藏的教程网站

热门教程

asp投票系统二

时间:2022-07-02 22:44:20 编辑:袖梨 来源:一聚教程网

<%
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
%>

此文件和来判断是否己投票并进行数据处理.

热门栏目