<% Dim fs, ts, line1, line2, fnd, pos, cnt, sPath Const ForReading = 1, ForWriting = 2 Function DecodeCount (line) Dim pos, st pos = InStr (1, line, ":", 1) if pos <> 0 Then st = Trim (Mid (line, pos + 1)) DecodeCount = CInt (st) Else DecodeCount = 0 End If End Function sPath = Server.mapPath("stats.txt") Application.Lock Set fs = CreateObject ("Scripting.FileSystemObject") Set ts = fs.OpenTextFile (sPath, ForReading, True) fnd = 0 cnt = 0 if ts.AtEndOfStream <> True Then line1 = ts.ReadLine pos = InStr (1, line1, "sales", 1) If pos <> 0 Then cnt = DecodeCount (line1) + 1 line1 = "Sales file access count: " & CStr (cnt) End If fnd = fnd + 1 End If if ts.AtEndOfStream <> True Then line2 = ts.ReadLine pos = InStr (1, line2, "sales", 1) If pos <> 0 Then cnt = DecodeCount (line2) + 1 line2 = "sales file access count: " & CStr (cnt) End If fnd = fnd + 1 End If ts.Close if fnd < 1 Then line1 = "sales file access count: 1" fnd = 1 End If Set ts = fs.OpenTextFile (sPath, ForWriting, True) If fnd > 0 Then ts.WriteLine (line1) End If If fnd > 1 Then ts.WriteLine (line2) End If ts.Close () Application.Unlock %> Loading sales file ...