I just found a counter. Since the website has too few visits, it is really a bit shabby to put a counter there, so I can only make a simple one, which can be accessed and recorded once to support the storefront. I used to have one, but I was depressed that I couldn't find it. I sang it online and finally got it done. The specific program code is as follows.
The code for count.asp is:
The code copy is as follows:
<%
optionexplicit
dimfs,filename,txt,content,total,counter_lenth
counter_lenth=1' sets the minimum length of the displayed data. If it is less than the actual length, the actual length shall prevail.
setfs=Server.CreateObject("Scripting.FileSystemObject")
filename=server.MapPath("count.txt")
ifnotfs.FileExists(filename)then
fs.CreateTextFilefilename,True,True
settxt=fs.OpenTextFile(filename,2,true)
txt.write0'If there is no file that saves data, create a new file and write data 0
setfs=nothing
endif
settxt=fs.OpenTextFile(filename)
Iftxt.AtEndOfStreamThen
Application("Counter")=0' If there is no data in the file, the value of Application("Counter") is initialized (for fault tolerance)
else
Application("Counter")=txt.readline
endif
Application.Lock
Application("Counter")=Application("Counter")+1
Application.UnLock
Functionsave_'Save count function
setfs=Server.CreateObject("Scripting.FileSystemObject")
filename=server.MapPath("count.txt")
content=Application("Counter")
settxt=fs.OpenTextFile(filename,2,true)
txt.writecontent
setfs=nothing
EndFunction
save_'Call save function to save data
FunctionDigital(counter)' display data function
Dimi, MyStr, sCounter
sCounter=CStr(counter)
Fori=1Tocounter_lenth-Len(sCounter)
MyStr=MyStr&"0"
'MyStr=MyStr&"<IMGSRC=Change it into the relative directory where you store your own picture/0.gif>"'If there are pictures, you can call this statement
Next