HOME COMPANY INFO SERVICES HOSTING Products DOWNLOADS UTILITIES CAREERS LINKS
News YOUR IP ADDRESS IS 38.103.63.61 Wednesday, August 20, 2008
 
 

Hosting
Free Domain Name with year subsciption
Annual price Space
$120 50mb
$180 100mb
$240 200mb

Log in
Username
Password
 

     





contact us Print

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.
Commandline Media Copyright ©1999-2003 |  Home  Utilities