Add a page counter
How to Count Active Visitors on your Website
You need to pay attention to 3 things. A page called "counter.txt",
the following code, and to rename your pages with the extension ".asp" instead of ".html".
Add this ASP code to the bottom of your page and rename the page ".asp":
----------------------------
< %
Dim ObjCounterFile, ReadCounterFile, WriteCounterFile
Dim CounterFile
Dim CounterHits
Set ObjCounterFile = Server.CreateObject("Scripting.FileSystemObject")
CounterFile = Server.MapPath ("counter.txt")
Set ReadCounterFile= ObjCounterFile.OpenTextFile (CounterFile, 1, True)
If Not ReadCounterFile.AtEndOfStream Then
CounterHits = Trim(ReadCounterFile.ReadLine)
If CounterHits = "" Then CounterHits = 0
Else
CounterHits = 0
End If
ReadCounterFile.Close
Set ReadCounterFile = Nothing
CounterHits = CounterHits + 1
Set WriteCounterFile= ObjCounterFile.CreateTextFile (CounterFile, True)
WriteCounterFile.WriteLine(CounterHits)
WriteCounterFile.Close
Set WriteCounterFile = Nothing
Set ObjCounterFile = Nothing
% >
There have been < % =CounterHits % > visitors to this website!
----------------------------
You can download the "counter.txt" file and the page "text_counter.asp"
which has the above code in it here.
You need to pay attention to 3 things. A page called "counter.txt",
the following code, and to rename your pages with the extension ".asp" instead of ".html".
Add this ASP code to the bottom of your page and rename the page ".asp":
----------------------------
< %
Dim ObjCounterFile, ReadCounterFile, WriteCounterFile
Dim CounterFile
Dim CounterHits
Set ObjCounterFile = Server.CreateObject("Scripting.FileSystemObject")
CounterFile = Server.MapPath ("counter.txt")
Set ReadCounterFile= ObjCounterFile.OpenTextFile (CounterFile, 1, True)
If Not ReadCounterFile.AtEndOfStream Then
CounterHits = Trim(ReadCounterFile.ReadLine)
If CounterHits = "" Then CounterHits = 0
Else
CounterHits = 0
End If
ReadCounterFile.Close
Set ReadCounterFile = Nothing
CounterHits = CounterHits + 1
Set WriteCounterFile= ObjCounterFile.CreateTextFile (CounterFile, True)
WriteCounterFile.WriteLine(CounterHits)
WriteCounterFile.Close
Set WriteCounterFile = Nothing
Set ObjCounterFile = Nothing
% >
There have been < % =CounterHits % > visitors to this website!
----------------------------
You can download the "counter.txt" file and the page "text_counter.asp"
which has the above code in it here.

