<%
' Developed by Keith @
' http://www.dogtagprograms.com
' [email protected]
'-----------------------------------------------
'----- Variables -------------------------------
'-----------------------------------------------
' Do not change these lines
dim PathFile
dim ShowCounter
dim inputfile'-----------------------------------------------
'----- Options ---------------------------------
'-----------------------------------------------
' PathFile should be the full path to the filename
' you would like to use for your data file
PathFile = "c:/full/path/to/file/counter.txt"
' Change this to 0 if you want the counter to be
' invisible, leave as 1 to see the page hit count
ShowCounter = 1
'-----------------------------------------------
'----- Code ------------------------------------
'-----------------------------------------------
' Do not edit below this line
dim FileSO
dim TextStream
dim cnt
dim PageHits()
dim PageName()
dim got
inputfile = Request.ServerVariables("SCRIPT_NAME")
inputfile = lcase(inputfile)
inputfile = Replace(inputfile,"/","_")
inputfile = replace(inputfile,"\","_")
Set FileSO = Server.CreateObject("Scripting.FileSystemObject")
cnt = 0
got = 0
if (not(FileSO.FileExists(PathFile))) then
Set TextStream = FileSO.CreateTextFile(PathFile, 1)
TextStream.WriteLine(inputFile)
TextStream.WriteLine("0")
TextStream.Close
end if
Set TextStream = FileSO.OpenTextFile(PathFile,1)
while not TextStream.atEndOfStream
ReDim preserve PageName(cnt)
ReDim preserve PageHits(cnt)
PageName(cnt) = TextStream.ReadLine
PageHits(cnt) = TextStream.ReadLine
if (inputFile = PageName(cnt)) then
PageHits(cnt) = PageHits(cnt) + 1
got = 1
end if
cnt = cnt + 1
wend
TextStream.close
set TextStream = nothing
Set TextStream = FileSO.OpenTextFile(PathFile,2)
cnt = 0
for each PageEnter in PageName
TextStream.WriteLine PageName(cnt)
TextStream.WriteLine PageHits(cnt)
cnt = cnt + 1
next
if (got = 0) then
TextStream.WriteLine inputFile
TextStream.WriteLine "1"
end if
TextStream.close
set TextStream = nothing
set FileSO = nothing
%>