Make your own free website on Tripod.com
<% WQuestion="Who is the best non-BCS QB?" Dim Res(8) Res(1)="Omar Jacobs, Bowling Green" Res(2)="Bruce Gradkowski, Toledo" Res(3)="Josh Betts, Miami (Ohio)" Res(4)="Jordan Palmer, UTEP" Res(5)="Darrell Hackney, UAB" Res(6)="Jared Zabransky, Boise State" Res(7)="Paul Pinegar, Fresno State" Res(8)="(Other)" ' Create folder /cgi-bin/pool397716 in case it does not exists ' All votes/opinions will be saved in this folder Foldertocheck=server.mappath("\") &"/cgi-bin/poll397716" Set fs = CreateObject("Scripting.FileSystemObject") if fs.FolderExists(Foldertocheck) then else Set a = fs.CreateFolder(Foldertocheck) end if Set fs=nothing ' Add the vote/opinion to the corresponding counter file ' Session method is used to avoid voting several times during one session if session("votationdone")="" then session("votationdone")="yes" Vote(request.form("answer")) end if ' Show results from previous votes Dim VoteCounter(8) for i=1 to 8 Set fs = CreateObject("Scripting.FileSystemObject") Wfile=server.mappath("\") & "\cgi-bin\poll397716\" & i & ".txt" on error resume next Set a = fs.OpenTextFile(Wfile) VoteCounter(i) = Clng(a.ReadLine) a.close if error then VoteCounter(i)=0 end if next for i=1 to 8 Totalvotes= Totalvotes + VoteCounter(i) next Response.write("" & WQuestion & "
") Response.write("") Response.write("") Response.write("") Response.write("") Response.write("") Response.write("") Response.write("") Response.write("") Response.write("") Response.write("
" & Res(1) & "" & VoteCounter(1) & "(" & INT(VoteCounter(1)*100/Totalvotes) & "%)
" & Res(2) & "" & VoteCounter(2) & "(" & INT(VoteCounter(2)*100/Totalvotes) & "%)
" & Res(3) & "" & VoteCounter(3) & "(" & INT(VoteCounter(3)*100/Totalvotes) & "%)
" & Res(4) & "" & VoteCounter(4) & "(" & INT(VoteCounter(4)*100/Totalvotes) & "%)
" & Res(5) & "" & VoteCounter(5) & "(" & INT(VoteCounter(5)*100/Totalvotes) & "%)
" & Res(6) & "" & VoteCounter(6) & "(" & INT(VoteCounter(6)*100/Totalvotes) & "%)
" & Res(7) & "" & VoteCounter(7) & "(" & INT(VoteCounter(7)*100/Totalvotes) & "%)
" & Res(8) & "" & VoteCounter(8) & "(" & INT(VoteCounter(8)*100/Totalvotes) & "%)
") %><% sub Vote(thevote) Set fs = CreateObject("Scripting.FileSystemObject") Wfile=server.mappath("\") & "\cgi-bin\poll397716\" & thevote & ".txt" on error resume next Set a = fs.OpenTextFile(Wfile) votes = Clng(a.ReadLine) votes = votes + 1 a.close if error then votes = 1 end if Set a = fs.CreateTextFile(Wfile,True) a.WriteLine(votes) a.Close end Sub %>
Script provided by AspTutorial.info