Categories

Subscribe via Email

Enter your email address to subscribe and receive notifications of new content by email.

Text Counter

Now create a folder called counters or you can call it something else if you want just remember and change the code above . Now create a text file called counter1.txt and enter whatever you wish to start the count at.

<%@ Language=VBScript %>
<%
Dim fso
Set fso = Server.CreateObject(“Scripting.FileSystemObject”)
//this is the path to your counter1.txt file
counter = Server.MapPath(“/counters”) & “\counter1.txt”
//open the text file
Set InStream = fso.OpenTextFile(counter , 1, False)
oldCount = Trim(InStream.ReadLine)
//increment the oldcount by 1 and store in newcount
newCount = oldCount + 1
Set OutStream = fso.CreateTextFile(counter, True)
//copy newcount to the text file
OutStream.WriteLine(newCount)
%>

Now you would place the folllowing where you want the counter to appear on your site

<%= newCount%>

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInWhatsAppBibSonomyDeliciousDiggDiigoSina WeiboWordPressBlogger PostShare

Leave a Reply

  

  

  


*

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>