Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: hit counter


Message #1 by "Subimal Banerjee" <subimal@g...> on Tue, 4 Jul 2000 17:31:52
This hit counter code I have used in a page hosted in a remote server 

didn't work at all. Can anybody tell me why

<%

	Set FileObject = Server.CreateObject("Scripting.FileSystemObject")

	Dir = Request.ServerVariables("SCRIPT_NAME")

	Dir = StrReverse(Dir)

	Dir = Mid(Dir, InStr(1, Dir, "/"))

	Dir = StrReverse(Dir)

	HitsFile = Server.MapPath(Dir) & "\hits.txt"



	On Error Resume Next

	Set InStream= FileObject.OpenTextFile (HitsFile, 1, false )

	OldHits = Trim(InStream.ReadLine)

	NewHits = OldHits + 1

	Set OutStream= FileObject.CreateTextFile (HitsFile, True)

	OutStream.WriteLine(NewHits)

%>



And the counter is



<%

L=Len(NewHits)

	i = 1

	For i = i to L

		num = Mid(NewHits,i,1)

	Display = Display & "<img src=""" & num & ".gif"">"

	Next

	Response.Write Display

%>


  Return to Index