Afstemning i asp? rettelse
Vil godt lige have hjælp til lidt rettelser?Det skal løbende være muligt at kunne se dem der deltager, altså f.eks. efter jeg har stemt vil jeg godt kunne se hvis der kommer 10 nye afstemninger til.
Er det noget der gider kigge på det for mig.
se eksempel.:
http://www.on-time.dk/afstemning/interface.asp
interface.asp
<%
Option Explicit
Response.Buffer = True
Dim DataPath, FSO, File, Count, Line, Arr_Line, NewData, Max_Rates, Total_Rates, TopProcent, Relation, Procent, Width
%>
<!Doctype HTML Public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store">
<title>Afstemning</title>
<!--
============================================================================
This script can be used freely as long as all copyright messages are intact.
Copyright (c) 2003 Morten Neesgaard (www.opfinderen.dk)
============================================================================
//-->
<style type="text/css">
body, td, font, i, b {
font-size: 13px;
font-family: arial, verdana, trebuchet, sans-serif;
}
</style>
</head>
<body>
<%
DataPath = Replace(Request.ServerVariables("Path_Translated"), "interface.asp", "data.asp")
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
If Request.Cookies("Rating")("Reg") = "" And Session("Reg") = "" Then
If Request.Form("answer") <> "" And Session("CookieCheck") = "ok" Then
Response.Cookies("Rating")("Reg") = "1"
Response.Cookies("Rating").Expires = Date + 365
Session("Reg") = "1"
Set File = FSO.OpenTextFile(DataPath, 1)
Count = 0
While Not File.AtEndOfStream
Count = Count + 1
Line = File.ReadLine
Arr_Line = Split(Line, "=")
If Count = CInt(Request.Form("answer")) Or Count = 1 Then
NewData = NewData & vbCrlf & Arr_Line(0) & "=" & CInt(Arr_Line(1)) + 1
Else
NewData = NewData & vbCrlf & Line
End If
Wend
Set File = FSO.OpenTextFile(DataPath, 2)
File.Write Right(NewData, Len(NewData) - 2)
Set File = Nothing
Set FSO = Nothing
Response.Redirect "interface.asp"
End If
Set File = FSO.OpenTextFile(DataPath, 1)
Response.Write "<form name=""rating"" action=""interface.asp"" method=""post"">" & vbCrlf
Count = 0
While Not File.AtEndOfStream
Count = Count + 1
Line = File.ReadLine
Arr_Line = Split(Line, "=")
If Count = 1 Then
Response.write "<font style=""font-size:22px;"">" & Arr_Line(0) & "</font><br><br><br>" & vbCrlf
If Session("CookieCheck") = "" Then
Response.write "<font style=""color:#990000;""><b>OBS! Du kan først stemme, når der kan lægges en cookie på din maskine.</b></font><br><br><br>"
End If
Else
Response.Write "<input type=""radio"" name=""answer"" value=""" & Count & """ onClick=""document.rating.submit();""> " & Arr_Line(0) & "<br>" & vbCrlf
End If
Wend
Response.Write "</form>" & vbCrlf
Else
Set File = FSO.OpenTextFile(DataPath, 1)
Count = 0
Max_Rates = 0
While Not File.AtEndOfStream
Count = Count + 1
Line = File.ReadLine
Arr_Line = Split(Line, "=")
If Count = 1 Then
Total_Rates = Arr_Line(1)
ElseIf CInt(Arr_Line(1)) > CInt(Max_Rates) Then
Max_Rates = Arr_Line(1)
End If
Wend
TopProcent = Round((CInt(Max_Rates) / CInt(Total_Rates)) * 100)
Relation = 100 / CInt(TopProcent)
Set File = FSO.OpenTextFile(DataPath, 1)
Count = 0
While Not File.AtEndOfStream
Count = Count + 1
Line = File.ReadLine
Arr_Line = Split(Line, "=")
Procent = Round(CInt(Arr_Line(1)) / CInt(Total_Rates) * 100)
Width = Round(CInt(Procent) * CInt(Relation))
If Width < 2 Then
Width = "1"
End If
If Count = 1 Then
Response.Write "<font style=""font-size:22px;"">" & Arr_Line(0) & "</font><br><i>Baseret på " & Total_Rates & " stemmer</i><br><br><br>" & vbCrlf
Else
Response.Write "<table cellspacing=""0"" style=""margin: 1px 0px 1px 0px;""><tr><td style=""width:250px;"">" & Arr_Line(0) & " (" & Procent & "%)</td><td style=""background-color:#000000; width:" & Width & "px;"">a</td></tr></table>" & vbCrlf
End If
Wend
End If
Set File = Nothing
Set FSO = Nothing
Session("CookieCheck") = "ok"
%>
</body>
</html>
