<%
Function hitCounter()
'################################################
'#HitCounter 1.0 2001
'#Author: Patrik Andersson
'#Email: asp_dev@hotmail.com
'##############################################
'Declare some variables
Dim imageFolder
Dim intDigits
Dim counterFile
Dim intCount
Dim intNum
Dim intLen
Dim fs
'ImageFolder:
'Contains the path to where the count.txt file is. If the file that contains this function
'is in the same folder you can leave it blank. If your pics are in another folder you must end the string with a slash (/).
imageFolder = "images/simple/"
'imageFolder = "images/classic/"
'intDigits:
'Here you set the value of how many digits you want. Lets say the value in the counterfile is 123
'but you want it to look like this, 000123, you give intDigits the value 6.
intDigits = 6
'CounterFile: The name of the counter file.
CounterFile = Server.MapPath("count.txt")
'Create the object
Set fs = CreateObject("Scripting.FileSystemObject")
'Check to see if the counterfile exists.
if fs.FileExists(counterFile) = False Then
'The file doesn't exist so create it and write the number 1 to it.
Set f = fs.CreateTextFile (CounterFile, 1, 0)
f.writeLine 1
c = 1
Set f = Nothing
else
'The counterfile exists so read the number from it.
Set a = fs.OpenTextFile(CounterFile, 1, 0, 0)
c = a.Readline
c = c + 1
'Increase the number with 1
set b = fs.CreateTextFile (CounterFile, 1, 0)
'Write back the new value to the counterfile.
b.WriteLine c
'Close everything
Set b = Nothing
Set a = Nothing
Set fs= Nothing
End if
'Now we are gonna see how many zeros (0) we should place infront of the number.
'Fist we take the value from the variable c and place it in a new variable.
intNum = c
'We need to determine how many characters the value has.
'intNum = 78, intLen = 2
'intNum = 456, intLen = 3
intLen = Len(intNum)
'How many Zero infront of the counter value
'intDigits = 6, intLen = 3 (000xxx)
intDigits = 5, intLen = 4 (0xxxx)
intCount = intDigits - cint(intLen)
'Print out the code for showing 0.gif.
For x = 1 To intCount
Response.Write ("")
Next
'Go through every digit and show the correct image for it.
For i = 1 To intLen
Response.Write ""
Next
End Function
%>
<%call hitCounter()%>