Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Your Email:

Simple Text Display Web Page Counter

This simple page counter uses the File System Object to store the page count in a text file located on the server.



You must have the use of the File System Object and enable the server to read and write to the text file.



<%

'Simple asp page counter by Barry Wright

'Using the File System Object

'Create the FSO

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




'Location of text file to store page count.

Set bwoFile = bwoFSO.OpenTextFile("C:\wwwroot\count.txt")




'now we read the number in the file

oldNum = CLng(bwoFile.ReadLine)




'and we close

bwoFile.Close




'we add one to the number

newNum = oldNum + 1




'we open the file to overwrite the new number to it

Set bwoFile = bwoFSO.OpenTextFile("C:\wwwroot\count.txt",2,true)




'and we overwrite it here

bwoFile.WriteLine(newNum)




'and we close the file again

bwoFile.Close




'now we use the number for our display

strCount = newNum

%>




Place following code where you want your counter to appear.

<%

'Write the pagecount

Response.Write(strCount)

%>




Author: Barry Wright
Price: Free
Version: V1.01 Scripts
Platform(s): ASP
Rating:
Total Votes: 17
Download Script: click here

Visit Site | Bookmark | Digg It! | Stumbleupon! | Send to a Friend | Report Bad Link

More ASP Counters Scripts: