|
<%
'Dimension variables
Dim fsoObject 'File system object
Dim tsObject 'Text Stream Object
Dim filObject 'File object
Dim lngVisitorNumber 'Holds the visitor number
Dim intDisplayDigitsLoopCount 'Loop counter to diplay the graphica; hit count
'Error handler
On Error Resume Next
'Initialise variables
lngVisitorNumber = 0
'Initialise file system object
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
'Intilise the file Object with the path and name of the file to open
Set filObject = fsoObject.GetFile(Server.MapPath("visitas.txt"))
'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 nember by 1
lngVisitorNumber = lngVisitorNumber + 1
'Create the visitor counter text file
Set tsObject = fsoObject.CreateTextFile((Server.MapPath("visitas.txt")), True)
'Write the new visitor number to the text file
tsObject.Write CStr(lngVisitorNumber)
'Reset server variables
Set fsoObject = Nothing
Set tsObject = Nothing
Set filObject = Nothing
'HTML output to display the visitor number
Response.Write " V I S I T A S "
'Loop to display grapical digits
For intDisplayDigitsLoopCount = 1 to Len(lngVisitorNumber)
'Display the graphical hit count by getting the path to the image using the mid function
Response.Write " "
Next
'Alternative to display text output instead
'Response.Write(lngVisitorNumber)
%>
|