<% 'Two varibles are passed into the db 'u_input is the value if the user entered a response to 'the vote/poll question....IP is the address of the user u_input=request.form("u_input") u_ip=request.servervariables("remote_addr") ' if the user did not enter anything in the poll on this visit ' then display the poll question and possible choices if u_input = "" then %>
">

Welche Marke TFT-Bildschirme bevorzugen Sie?

Belinea
Sony
Samsung
HP
Compaq
Philips
Eizo
Andere

Ergebnis ansehen
<% else ' if the user did input a choice on the vote/bildschirm ' check to see if their ip address is already in the db accessdb="votes_db" cn="driver={Microsoft Access Driver (*.mdb)};" cn=cn & "dbq=" & server.mappath(accessdb) set rs = server.createobject("ADODB.Recordset") sql = "select ip from bildschirm where ip ='" & u_ip & "'" rs.Open sql, cn if rs.eof then ' if the user has not voted previously indicate it been_here_before="No" end if rs.close if been_here_before = "No" then ' Since the user has not voted previously their input ' their vote will be added to the db sql = "insert into bildschirm (ip, selection" & u_input &") " sql = sql & "values ('" & u_ip & "',1)" rs.Open sql, cn end if 'This will summerize and count the records in the db sql= "select distinctrow sum(selection1) as sum_selection1, " sql= sql & "sum(selection2) AS sum_selection2, sum(selection3) AS sum_selection3, " sql= sql & "sum(selection4) AS sum_selection4, sum(selection5) AS sum_selection5, " sql= sql & "sum(selection6) AS sum_selection6, sum(selection7) AS sum_selection7, " sql= sql & "sum(selection8) AS sum_selection8, count(*) AS total_votes " sql= sql & "FROM bildschirm;" 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") count=rs ("total_votes") %>

Welchen Marke TFT-Bildschirme bevorzugen Sie?

Belinea <%= formatnumber((total1/count)*100,1) %>%
Sony <%= formatnumber((total2/count)*100,1) %>%
Samsung <%= formatnumber((total3/count)*100,1) %>%
HP <%= formatnumber((total4/count)*100,1) %>%
Compaq <%= formatnumber((total5/count)*100,1) %>%
Philips <%= formatnumber((total6/count)*100,1) %>%
Eizo <%= formatnumber((total7/count)*100,1) %>%
Andere <%= formatnumber((total8/count)*100,1) %>%

Total Stimmen: <%= formatnumber(count,0,0) %>
<% if been_here_before <> "No" then %> Dieser User hat schon einmal abgestimmt und wurde nicht gezählt... <% else %> Die Stimme wurde erfolgreich gezählt... <% end if %>
<% end if %>