<% Dim fso, ftxt, counter On Error Resume Next ' Create a server object Set fso=CreateObject("Scripting.FileSystemObject") ' Target the text file to be opened Set ftxt=fso.OpenTextFile(Server.MapPath("count.txt")) ' Read the value of the text document ' If the text document does not exist then the on error resume next ' will drop down to the next line counter=CLng(ftxt.readline) ' Add one to the counter counter=counter+1 ' Close the object ftxt.Close ' Create a new text file on the server Set ftxt=fso.CreateTextFile(Server.MapPath("count.txt"), true) ' Write the current counter value to the text document ftxt.WriteLine(counter) ' Close the object ftxt.Close ' Write the counter to the browser as text 'Response.Write counter %>
Hits: <%=counter%> Copyright © 2003-2010, Balestier Khalsa Football Club. All Rights Reserved.