Writing counters with ASP

Source: Internet
Author: User
Counter <%


  


Dim Fso,f,no,i ' Defining variables is definitely a good habit


  


Set fso = CreateObject ("Scripting.FileSystemObject") ' establishes an instance of an object


  


Set f = fso. OpenTextFile (Server.MapPath ("count.no"), 1, True) ' establishes a text file and opens it as read-only.


  


if F.atendofstream Then ' determines if this file does not exist


  


no=1


  


Else


  


No=f.readline


  


no=no+1


  


End If


  


F.close


  


set F=FSO. OpenTextFile (Server.MapPath ("count.no"), 2,true) ' ready to write


  


F.write (No) ' Write to


  


F.close


  


' Improved logo 1


  


no=cstr (NO) ' neat digital


  


for I=1 to 5-len (NO)


  


no= "0" &no


  


Next


  


%>


  


<font color=white size=3pt> You are <font color=red><%=no%></font> a visitor </font>





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.