VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Web site counter -- Counts the number of visitors on your web site by recording the number in a tex

by Tanveer Mohammad (1 Submission)
Category: Active Server Pages
Compatability: ASP (Active Server Pages)
Difficulty: Unknown Difficulty
Originally Published: Tue 15th May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Web site counter -- Counts the number of visitors on your web site by recording the number in a text file using the filesystemobject.

Rate Web site counter -- Counts the number of visitors on your web site by recording the number in a tex



on error resume next 

' Create a server object
set fso = createobject("scripting.filesystemobject")

' Target the text file to be opened
set act = fso.opentextfile(server.mappath("/db/asp_count.txt"))

' Read the value of the text document
' If the text document does not exist then the on error resume next
' will drop down to the next line
counter = clng(act.readline)

' Add one to the counter
counter = counter + 1

' Close the object
act.close

' Create a new text file on the server
Set act = fso.CreateTextFile(server.mappath("/db/asp_count.txt"), true)

' Write the current counter value to the text document
act.WriteLine(counter)

' Close the object
act.Close

' Write the counter to the browser as text
Response.Write counter
%> Times Visited

Download this snippet    Add to My Saved Code

Web site counter -- Counts the number of visitors on your web site by recording the number in a tex Comments

No comments have been posted about Web site counter -- Counts the number of visitors on your web site by recording the number in a tex. Why not be the first to post a comment about Web site counter -- Counts the number of visitors on your web site by recording the number in a tex.

Post your comment

Subject:
Message:
0/1000 characters