How do I make a picture counter that prevents multiple refresh counts? _ Programming 10000 Q

Source: Internet
Author: User

How do I do a professional picture counter?

  <%

Countlong=8

' defines the number of counter digits .

  On Error Resume Next

' Ignore all the errors .

  Count=server.mappath (Count.txt)

  Set cou = Server.CreateObject (Scripting.FileSystemObject)

  Set Out=cou.opentextfile (Count,1,false,false)

  Counter=out.readline

  Out.close

  ' Open the count.txt and read the value of the current counter .

  If session (in) <>in then

  ' determine if the user has entered the home page and prevent users from refreshing or coming back to this page with a 1 counter added.

  Session (in) =in

  set out = Cou.createtextfile (Count,true,false)

  Application.Lock

  Counter=counter+1

' counter plus 1.

  Out.writeline (counter)

  Application.UnLock

  Out.close

  ' Create a new file count.txt and write the value of the counter after adding 1 .

  End If

  CO=CSTR (counter)

' converts a numeric variable to a character type .

  For i = 1 to Countlong-Len (CO)

' get The number of previous 0 pictures .

  Response.Write

  Next

 ' finish adding 0 pictures before the counter.

  For i= 1 to Len (CO)

  Response.Write

  Next

  ' start reading from the first bit of the variable co .

%>

[1]

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.