<!--#include virtual ="/include/UserTime.asp"-->
<html>
<head>
<link rel="stylesheet" type="text/css" href="../styles.css">
<title>w w w . F r e d e r i c i a - B y N i g h t . dk</title>
</head>
<body bgcolor="#3288A4">
<div align="center">
<table border="2" width="525" height="225" bordercolor="#000000" bgcolor="#6C8892">
<tr>
<td width="100%" valign="top">
<center>
<p align="center"><font face="Arial" size="2"><b><br>
Afstemningpå
www.Fredericia-ByNight.dk</b></font></p> </center>
<div align="center">
<table border="0" width="90%">
<tr>
<td width="100%">
<p align="center"><font face="Arial" size="2">
<%
Set Conn = CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database.mdb"))
strPollID = Request("id"): If strPollID = "" Or Not IsNumeric(strPollID) Then strPollID = "" Else strPollID = CInt(strPollID)
If strPollID > "" Then
If Not Request.Cookies("Poll")(CStr(strPollID)) = "voted" Then
strOptionID = Request("item")
If IsNumeric(strOptionID) Then
Conn.Execute "UPDATE polldata SET itemcount=itemcount+1 WHERE itemid=" & strOptionID & ";"
Response.Cookies("Poll")(CStr(strPollID)) = "voted"
Response.Cookies("Poll").Expires = DateAdd("d", 7, Now) ' // RET HVIS MAN KUN SKAL KUNNE STEMME F.EKS. EN
' // GANG OM UGEN (7 DAGE)
End If
End If
strUrl = Request.ServerVariables("HTTP_REFERER")
If strUrl = "" Then strURL = "afstemning.asp" ' // RET TIL DIN EGEN DEFEAULT URL!!!
Response.Redirect strUrl
Else
Set Rs = Conn.Execute("SELECT pollid FROM polls;")
If Not Rs.BOF Then
Set Rs = Conn.Execute("SELECT MAX(pollid) FROM polls;"): pollid = CInt(Rs(0))
OptionID = Not (Request.Cookies("Poll")(CStr(pollid)) = "voted")
intPlace = 1
Set Rs = Conn.Execute("SELECT * FROM polls WHERE pollid=" & pollid & ";")
%>
<font face="Arial" size=2><b><%=Rs("polldesc")%></b></font>
<br>
<br>
</font>
<div align="center">
<table border=0 width=245 cellspacing=0 cellpadding=0 height="60">
<%
Set Rs = Conn.Execute("SELECT SUM(itemcount) FROM polldata WHERE parent=" & pollid & ";"): Total = Rs(0)
Set Rs = Conn.Execute("SELECT * FROM polldata WHERE parent=" & pollid & ";")
Do Until Rs.EOF Or Rs.BOF
If Total > 0 Then Result = Int((Rs("itemcount") / Total) * 100) Else Result = 0
Select Case OptionID
Case True: %>
<tr>
<td width="122">
<p><font face="Arial" size=2><a href="afstemning.asp?id=<%=pollid%>&item=<%=Rs("itemid")%>"><b><%=Rs("item")%></b></a></font></p>
</td>
<td width="123"> </td>
</tr>
<%
Case False: %>
<tr>
<td width="122"><font face="Arial" size=2><b><%=Rs("item")%></b>
</font></td>
<td width="123">
<div align="right"><font face="Arial" size=2>(<%=Result%>%)</font></div>
</td>
</tr>
<%
End Select
Rs.MoveNext
intPlace = intPlace + 1
Loop
Response.Write "</table>"
If Not OptionID Then Response.write "<font face='Verdana' size=2>Antal stemmer: " & Total & "</font>"
Else
Response.Write "Der er ingen afsteminger!"
End If
End If
Set Rs = Nothing
Conn.close: Set Conn = Nothing
%>
</table>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>