|
This is a simple counter example you can use on
your website .
Firstly add the code below to your site usually
at the top of the page that the counter is on.
<%@ Language=VBScript %>
<%
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
counter = Server.MapPath("/counters") & "\counter1.txt"
Set InStream = fso.OpenTextFile(counter , 1, False)
oldCount = Trim(InStream.ReadLine)
newCount = oldCount + 1
Set OutStream = fso.CreateTextFile(counter, True)
OutStream.WriteLine(newCount)
%>
Now you would place the folllowing where you want the counter
to appear on your site
<%= newCount%>
Now create a folder called counters or you can call it something
else if you want just remember and change the code above . Now
create a text file called counter1.txt and type a zero (0) in
it or if you want to cheat put another number in it .
You can have multiple counters by just changing the counter1
to a different file name like counter2 , counter3 etc.
|