T
Trevor L.
The subject says it, I think.
I have a hit counter on my page below
The code is
<b>Hit Counter: </b><!--#include file='_fpclass/hit_count.inc'-->
where '_fpclass/hit_count.inc' is
<%
'Dimension variables
Dim fsoObject 'File System Object
Dim filObject 'File Object
Dim tsObject 'Text Stream Object
Dim lngVisitorNumber 'Holds the visitor number
Dim intWriteDigitLoopCount 'Loop counter to display the graphical hit count
Dim cntDigit 'Holds the digit displayed in the counter
'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("_private/index.asp.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("_private/index.asp.cnt"))
'Write the new visitor number to the text file
tsObject.Write CStr(lngVisitorNumber)
'Reset server objects
Set fsoObject = Nothing
Set filObject = Nothing
Set tsObject = 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
cntDigit = Mid(lngVisitorNumber, intWriteDigitLoopCount, 1)
Response.Write("<img src=""counter_images/")
Response.Write(cntDigit & ".gif""")
Response.Write(" alt=""" & cntDigit & """>")
Next
%>
What I am wondering is:
Why does the count increment by 3 every time I visit the Guestbook and then
return to the Home Page ?
The Guestbook button is
<a href="guestbook.asp" target="_self">
<img src="images/display/guestbook-icon1.gif" alt="Guestbook" height="40"
/><br />
Guestbook</a>
Even clicking Home increments it by 2
The Home button is
<a href="index.asp" target="_self">
<img src="images/display/sitehome.gif" alt="Home" /><br />
Home</a>
Visiting my other web site and then returning does the same thing
(increments it by 2).
This button is
<a href="http://tandcl.homemail.com.au">
<img src="images/display/trevor-and-carole.gif" alt="T&C" /><br />
Trevor and Carole's<br />Home Page</a>
Is there some way I can only increment the counter when the site
(http://trevorl.mvps.org/) is visited for the first time?
And going to somewhere else and then returning will not increment it?
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------
I have a hit counter on my page below
The code is
<b>Hit Counter: </b><!--#include file='_fpclass/hit_count.inc'-->
where '_fpclass/hit_count.inc' is
<%
'Dimension variables
Dim fsoObject 'File System Object
Dim filObject 'File Object
Dim tsObject 'Text Stream Object
Dim lngVisitorNumber 'Holds the visitor number
Dim intWriteDigitLoopCount 'Loop counter to display the graphical hit count
Dim cntDigit 'Holds the digit displayed in the counter
'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("_private/index.asp.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("_private/index.asp.cnt"))
'Write the new visitor number to the text file
tsObject.Write CStr(lngVisitorNumber)
'Reset server objects
Set fsoObject = Nothing
Set filObject = Nothing
Set tsObject = 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
cntDigit = Mid(lngVisitorNumber, intWriteDigitLoopCount, 1)
Response.Write("<img src=""counter_images/")
Response.Write(cntDigit & ".gif""")
Response.Write(" alt=""" & cntDigit & """>")
Next
%>
What I am wondering is:
Why does the count increment by 3 every time I visit the Guestbook and then
return to the Home Page ?
The Guestbook button is
<a href="guestbook.asp" target="_self">
<img src="images/display/guestbook-icon1.gif" alt="Guestbook" height="40"
/><br />
Guestbook</a>
Even clicking Home increments it by 2
The Home button is
<a href="index.asp" target="_self">
<img src="images/display/sitehome.gif" alt="Home" /><br />
Home</a>
Visiting my other web site and then returning does the same thing
(increments it by 2).
This button is
<a href="http://tandcl.homemail.com.au">
<img src="images/display/trevor-and-carole.gif" alt="T&C" /><br />
Trevor and Carole's<br />Home Page</a>
Is there some way I can only increment the counter when the site
(http://trevorl.mvps.org/) is visited for the first time?
And going to somewhere else and then returning will not increment it?
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------