Welcome to
Blackadon Barns

Blackadon Barns - Self-catering cottage holidday accommodation in South Devon

South Devon

 

<% 'read and print counter TheCount = ReadCounter("CounterMainPage.txt") Response.Write(TheCount) 'update counter by 1 WriteCounter "CounterMainPage.txt",TheCount + 1 Function ReadCounter(TheFile) TheFile = server.mappath(TheFile) Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFile = oFSO.OpenTextFile(TheFile,1,True,0) If Not oFile.AtEndOfStream Then TheCount = CLng(oFile.ReadLine) End If oFile.Close Set oFile = Nothing Set oFSO = Nothing ReadCounter = TheCount End Function Function WriteCounter(TheFile, TheCounter) TheFile = server.mappath(TheFile) Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFile = oFSO.CreateTextFile(TheFile) oFile.WriteLine TheCounter oFile.Close Set oFile = Nothing Set oFSO = Nothing End Function %>