Page counter improvement version, refresh page is invalid

xiaoxiao2021-03-06  14

First of all, first do a few pictures, here is the method of comparison, huh, huh, there is no Body.fix this file, so you need to call the digital map method, here, there is not much to say this, build a file Getting a digital figure in the name of 0-9 is a digital figure, and then create a notepad hits.txt <% function showcounter () on Error Resume next Dim Intwidth, intlength, i, url '**** *********************** Set the number of digits displaying the number INTWIDTH = 7 '************** ************** URL = "counter" 'session ("click") = 0 set fileObject = server.createObject ("scripting.FileSystemObject") DIR = Request.ServerVariables ("script_name" ) DIR = Strreverse (DIR) DIR = MID (Dir, INSTR (1, Dir, "/")) DIR = STREVERSE (DIR) Hitsfile = Server.MAppath (Dir) & "/" & URL & "/ Hits.txt " 'response.write HitsFile' response.end Set InStream = FileObject.OpenTextFile (HitsFile, 1, false) OldHits = Trim (InStream.ReadLine) if session (" click ") = 0 then NewHits = OldHits 1 session (" click ") = 1 else NewHits = OldHits end if Set OutStream = FileObject.CreateTextFile (HitsFile, True) OutStream.WriteLine (NewHits) intLength = Len (NewHits) if intLength> intWidth then NewHits = 0 end if Num = 0 for i = 1 to intWidth-intLength Display = Display & Num next for i = 1 To intLength Num = MID (Newhits, I, 1) Display = Display & Num next response.write displayend function%>

Simply import In the page you want to display, you can put <% showcounter ()% in the place you need to display.

转载请注明原文地址:https://www.9cbs.com/read-67551.html

New Post(0)