Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Graphic COUNTER

Status
Not open for further replies.

Ladyborg

Programmer
May 11, 2002
208
0
0
US
I need a counter script that's easy to use. Any suggestions? I am tired of using Bravenet types which contain advertisement, I just want a simple number counter script to run on a Windows server.

ladyborg64x64.gif
Ladyborg
"Many of life's failures are people who did not realize how close they were to success when they gave up." [Thomas A. Edison]
 
ASP:
Code:
<!-- ========================================================================== -->
<!--  Counter for visitors that displays number of visits in a form of images                         -->
<!-- ========================================================================= -->
<% 
'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(&quot;Scripting.FileSystemObject&quot;)
'Initialise a File Object with the path and name of text file to open
Set filObject = fsoObject.GetFile(Server.MapPath(&quot;hit_count.txt&quot;))
'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(&quot;hit_count.txt&quot;))
'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
'Loop to display graphical digits
For intWriteDigitLoopCount = 1 to Len(lngVisitorNumber)
	'Display the graphical hit count
	Response.Write(&quot;<img src=&quot;&quot;counter_images/&quot;) 
	Response.Write(Mid(lngVisitorNumber, intWriteDigitLoopCount, 1) & &quot;.gif&quot;&quot;&quot;) 
	Response.Write(&quot;alt=&quot;&quot;&quot; & Mid(lngVisitorNumber, intWriteDigitLoopCount, 1) & &quot;&quot;&quot;>&quot;)

Next
%>
of course...make the images(0-9) and the little &quot;hit_count.txt&quot; file...
All the best!

> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top