%@ Language=VBScript %> <% ' Declare our vaiables Dim objFSO, objCountFile ' object vars for FSO and File Dim strCountFileName ' count text file Dim iCount ' count variable Dim bUseImages ' boolean Dim I ' looping var strCountFileName = Server.MapPath(Request.ServerVariables("SCRIPT_NAME") & ".cnt") ' Create FileSystemObject to deal with file access Set objFSO = Server.CreateObject("Scripting.FileSystemObject") ' Open the file as a text stream (1 = ForReading, True = Create) Set objCountFile = objFSO.OpenTextFile(strCountFileName, 1, True) ' Read the current count from the file If Not objCountFile.AtEndOfStream Then ' Set value to contents of the file iCount = CLng(objCountFile.ReadAll) Else ' If no file exists or it's empty start at 0 iCount = 0 End If ' Close the file and destroy the object objCountFile.Close Set objCountFile = Nothing ' Increment the count iCount = iCount + 1 ' Overwrite existing file and get a text stream to new one Set objCountFile = objFSO.CreateTextFile(strCountFileName, True) ' Write updated count objCountFile.Write iCount ' Close the file objCountFile.Close Set objCountFile = Nothing ' Destroy the FSO object Set objFSO = Nothing For I = 1 to Len(iCount) Next %>
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||