Gluten

Which is your favorite flavor?
  Cherry Nirvana 
  Chocolate Brownie Almond 
  Vanilla 
  Peanut Butter Zig Zag 
<% WQuestion="Which is your favorite flavor?" Dim Res(4) Res(1)="Cherry Nirvana" Res(2)="Chocolate Brownie Almond" Res(3)="Vanilla" Res(4)="Peanut Butter Zig Zag" ' Create folder /cgi-bin/pool761989 in case it does not exists ' All votes/opinions will be saved in this folder Foldertocheck=server.mappath("\") &"/cgi-bin/poll761989" 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(4) for i=1 to 4 Set fs = CreateObject("Scripting.FileSystemObject") Wfile=server.mappath("\") & "\cgi-bin\poll761989\" & 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 4 Totalvotes= Totalvotes + VoteCounter(i) next Response.write("" & WQuestion & "
") 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) & "%)
") %><% sub Vote(thevote) Set fs = CreateObject("Scripting.FileSystemObject") Wfile=server.mappath("\") & "\cgi-bin\poll761989\" & 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


 
   
 
   
   
Home Page