Curry Poll

<% u_input=request.form("u_input") u_ip=request.servervariables("remote_addr") accessdb="../cgi-bin/poll.mdb" cn="driver={Microsoft Access Driver (*.mdb)};" cn=cn & "dbq=" & server.mappath(accessdb) set rs = server.createobject("ADODB.Recordset") sql = "select ip from ballot where ip ='" & u_ip & "'" rs.Open sql, cn if rs.eof then been_here_before="No" else been_here_before="Yes" end if rs.close if been_here_before = "No" then if u_input = "" then else sql = "insert into ballot (ip, selection" & u_input &") " sql = sql & "values ('" & u_ip & "',1)" rs.Open sql, cn been_here_before="Yes" end if end if 'This will summerize and count the records in the db sql= "select distinctrow " sql= sql & "sum(selection1) as sum_selection1, " sql= sql & "sum(selection2) as sum_selection2, " sql= sql & "sum(selection3) as sum_selection3, " sql= sql & "sum(selection4) as sum_selection4, " sql= sql & "sum(selection5) as sum_selection5, " sql= sql & "sum(selection6) as sum_selection6, " sql= sql & "sum(selection7) as sum_selection7, " sql= sql & "sum(selection8) as sum_selection8, " sql= sql & "sum(selection9) as sum_selection9, " sql= sql & "count(*) AS total_votes " sql= sql & "FROM ballot;" rs.Open sql, cn total1=rs ("sum_selection1") total2=rs ("sum_selection2") total3=rs ("sum_selection3") total4=rs ("sum_selection4") total5=rs ("sum_selection5") total6=rs ("sum_selection6") total7=rs ("sum_selection7") total8=rs ("sum_selection8") total9=rs ("sum_selection9") count=rs ("total_votes") %>

What is your favourite type of curry ?
Bhuna <%= formatnumber((total1/count)*100,1) %>%
Dhansak <%= formatnumber((total2/count)*100,1) %>%
Dupiaza <%= formatnumber((total3/count)*100,1) %>%
Korma <%= formatnumber((total4/count)*100,1) %>%
Madras <%= formatnumber((total5/count)*100,1) %>%
Pathia <%= formatnumber((total6/count)*100,1) %>%
Phall <%= formatnumber((total7/count)*100,1) %>%
Rogan Josh <%= formatnumber((total8/count)*100,1) %>%
Vindaloo <%= formatnumber((total9/count)*100,1) %>%

Total Votes: <%= formatnumber(count,0,0) %> (You can only vote once)     
<%if been_here_before="No" then%>
">
Vote now
Bhuna
Dhansak
Dupiaza
Korma
Madras
Pathia
Phall
Rogon Josh
Vindaloo
<% end if %>
<% u_input2=request.form("u_input2") u_ip=request.servervariables("remote_addr") accessdb="../cgi-bin/poll2.mdb" cn="driver={Microsoft Access Driver (*.mdb)};" cn=cn & "dbq=" & server.mappath(accessdb) set rs = server.createobject("ADODB.Recordset") sql = "select ip from ballot where ip ='" & u_ip & "'" rs.Open sql, cn if rs.eof then been_here_before="No" else been_here_before="Yes" end if rs.close if been_here_before = "No" then if u_input2 = "" then else sql = "insert into ballot (ip, selection" & u_input2 &") " sql = sql & "values ('" & u_ip & "',1)" rs.Open sql, cn been_here_before="Yes" end if end if 'This will summerize and count the records in the db sql= "select distinctrow " sql= sql & "sum(selection1) as sum_selection1, " sql= sql & "sum(selection2) as sum_selection2, " sql= sql & "sum(selection3) as sum_selection3, " sql= sql & "sum(selection4) as sum_selection4, " sql= sql & "sum(selection5) as sum_selection5, " sql= sql & "sum(selection6) as sum_selection6, " sql= sql & "sum(selection7) as sum_selection7, " sql= sql & "sum(selection8) as sum_selection8, " sql= sql & "sum(selection9) as sum_selection9, " sql= sql & "count(*) AS total_votes " sql= sql & "FROM ballot;" rs.Open sql, cn total1=rs ("sum_selection1") total2=rs ("sum_selection2") total3=rs ("sum_selection3") total4=rs ("sum_selection4") total5=rs ("sum_selection5") total6=rs ("sum_selection6") total7=rs ("sum_selection7") total8=rs ("sum_selection8") total9=rs ("sum_selection9") count=rs ("total_votes") %>
How often do you eat curry ?
3 times a day <%= formatnumber((total1/count)*100,1) %>%
Every day <%= formatnumber((total2/count)*100,1) %>%
Three times a week <%= formatnumber((total3/count)*100,1) %>%
Twice a week <%= formatnumber((total4/count)*100,1) %>%
Once a week <%= formatnumber((total5/count)*100,1) %>%
Every fornight <%= formatnumber((total6/count)*100,1) %>%
Once a month <%= formatnumber((total7/count)*100,1) %>%
Once a year <%= formatnumber((total8/count)*100,1) %>%
Never <%= formatnumber((total9/count)*100,1) %>%

Total Votes: <%= formatnumber(count,0,0) %> (You can only vote once)     
<%if been_here_before="No" then%>
">
Vote now
3 times a day
Every day
Three times a week
Twice a week
Once a week
Every fornight
Once a month
Once a year
Never
<% end if %>



[ Home | Search | Add | Indexes | News | Links | Guestbook | Poll | T-shirt | About ]