
|
 |

|
|
<% Response.Buffer = True %>
<%
Dim PollID
PollID = "18"'Request.QueryString("PollID")
If Len(PollID) <> 0 Then ' Check to see if a PollID was given
' Lookup poll id in database
Set objConn = CreateObject("ADODB.Connection")
Dim objConn
dim rspoll
dim optionid
dim total
dim rspolloptions
dim result
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("db\polls.mdb"))
' Load the poll that matches PollID
Set rsPoll = objConn.Execute("SELECT * FROM Polls WHERE PollID=" & PollID)
If rsPoll.EOF Then
Response.write "No Such Poll"
Else ' Poll exists
If Request.Cookies("devdomainpoll")(PollID) = "voted" Then ' Has Voted
OptionID = false ' Don't display the vote links
Else
OptionID = Request.QueryString("OptionID")
If Len(OptionID) > 0 Then ' User is trying to vote
' Update the count for the PollOption
objConn.Execute "UPDATE PollOptions SET OptionSelectedCount = " & _
"OptionSelectedCount + 1 WHERE PollOptionID=" & OptionID
' Set a cookie to stop the user from voting again
Response.Cookies("devdomainpoll")(PollID) = "voted"
Response.Cookies("devdomainpoll").Expires = Now() + 365
OptionID = false ' Don't display the vote links
Else
OptionID = true
End If
End If
Response.write ""
Response.write rsPoll("PollQuestion")
Response.write ""
%>
|
|
|
|