<% 'on error resume next 'err = 0 dim objFS, fleHits 'optionally we could create the initial file by hand Set objFS = CreateObject("Scripting.FileSystemObject") Set fleHits = objFS.OpenTextFile(server.MapPath("../cgi-bin/laibahits.txt"),1) if isObject(fleHits) then currentHits = fleHits.ReadLine if isNumeric(currentHits) then currentHits = clng(currentHits) else currentHits = 0 end if else currentHits = 0 end if fleHits.Close 'now we have the current hits currentHits = cstr(currentHits + 1) 'save the new hit to file Set fleHits = objFS.CreateTextFile(server.MapPath("../cgi-bin/laibahits.txt"),True) fleHits.writeLine cstr(currentHits) fleHits.close set objFs=nothing 'Now output to the screen 'response.write "
" 'alternatively we could just print out the results: response.write currentHits %>