|
| ||||||
|
|
|
Visitor No. -
<%
Response.Expires = 0
Dim strNetSite
'This is the only place you have to chan
' ge the name
'and the name of the file.
strNetSite = "www.bellsoftware.net/Training.htm"
if CheckCookie(strNetSite) = "False" Then
Call hitcounter
Call AddCookie
End if
function CheckCookie(strCookieName)
if Request.Cookies(strCookieName) = "" Then
CheckCookie = "False"
Else
CheckCookie = "True"
Dim fsoObject 'File System Object
Dim tsObject 'Text Stream Object
Dim filObject 'File Object
Dim lngVisitorNumber 'Holds the visitor number
Dim intWriteDigitLoopCount 'Loop counter to display the graphical hit count
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set filObject = fsoObject.GetFile(Server.MapPath("countTrain.cnt"))
Set tsObject = filObject.OpenAsTextStream
lngVisitorNumber = CLng(tsObject.ReadAll)
Response.Write(lngVisitorNumber)
End if
End function
function AddCookie()
Response.Buffer = True
Response.Cookies(strNetSite) = strNetSite
Response.Cookies(strNetSite).Expires = Date() + 1
End function
function hitcounter()
'Dimension variables
Dim fsoObject 'File System Object
Dim tsObject 'Text Stream Object
Dim filObject 'File Object
Dim lngVisitorNumber 'Holds the visitor number
Dim intWriteDigitLoopCount 'Loop counter to display the graphical hit count
'Create a File System Object variable
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
'Initialise a File Object with the path and name of text file to open
Set filObject = fsoObject.GetFile(Server.MapPath("countTrain.cnt"))
'Open the visitor counter text file
Set tsObject = filObject.OpenAsTextStream
'Read in the visitor number from the visitor counter file
lngVisitorNumber = CLng(tsObject.ReadAll)
'Increment the visitor counter number by 1
lngVisitorNumber = lngVisitorNumber + 1
'Create a new visitor counter text file over writing the previous one
Set tsObject = fsoObject.CreateTextFile(Server.MapPath("countTrain.cnt"))
'Write the new visitor number to the text file
tsObject.Write CStr(lngVisitorNumber)
'Reset server objects
Set fsoObject = Nothing
Set tsObject = Nothing
Set filObject = Nothing
'Display the hit count as text
Response.Write(lngVisitorNumber)
'Loop to display graphical digits
'For intWriteDigitLoopCount = 1 to Len(lngVisitorNumber)
'Display the graphical hit count
' Response.Write(" |
|
Bell Engineering Software
Technologists. Ltd. |