<%option explicit
response.buffer = true%>
<body bgcolor="white">
<!--#include file="connect.asp"-->
<%
response.buffer = true
'declaring
dim conn,sql,rs,x
dim useraction,ansid,sql1
dim ansdesc,newtotal,total,iTotal,t,ImageWidth
dim sql_statement
dim ors,rs2,ans
dim final_total
dim ansimage
dim votetwice,already,msg,ansPercent
dim queIDStr,queID,i,queIDarr
dim action,sql2,rs1,us,ansTotal
x = 0
'connect to db subroutine
set conn=server.createobject("adodb.connection")
conn.open dsn
'closing object subrotine
sub close()
rs.close
set rs=nothing
conn.close
set conn=nothing
end sub
action = request("action")
select case action
case "vote"
'--------------------------------------------------------
voteTwice=false
'---------------------------------------------------------
select case voteTwice
case true
if request.cookies("pollFlag")="" then
response.cookies("pollFlag")="already"
Response.Cookies("pollFlag").Expires = Date + 365
else
response.redirect "poll.asp?action=view&msg=1"
end if
end select
queIDStr = trim(request.form("queID"))
'response.write "*" & queIDStr & "*"
queIDarr = split(queIDStr,",")
for i=0 to ubound(queIDarr)
ansID = request.form("poll"& trim(queIDarr(i)) &"")
ansID = trim(ansID)
set rs = server.createobject("adodb.recordset")
if ansID="" then
x = x + 1
else
sql="select total from ans where id="&trim(ansID)
rs.open sql, conn
total=rs("total")
total=total+1
'response.write "<h1>" & total & "</h1>"
sql1="update ans set total="& total &" where id="&ansid
'response.write sql1
conn.execute(sql1)