<% dim ctr_FileObject,ctr_ActiveFile,ctr_counter dim ctr_script_name, ctr_fpath, ctr_stmp set ctr_FileObject = createobject("scripting.filesystemobject") ctr_script_name = trim(Request.ServerVariables("SCRIPT_NAME")) ctr_script_name = replace(ctr_script_name, "\", "/", 1, -1, 1) ctr_script_name = split(ctr_script_name, "/", -1, 1) ctr_stmp = ctr_script_name(ubound(ctr_script_name)) ctr_script_name = ctr_stmp ctr_script_name = split(ctr_script_name, ".", -1, 1) ctr_stmp = ctr_script_name(0) ctr_script_name = ctr_stmp ctr_fpath = Server.Mappath(ctr_script_name & ".txt") If ctr_FileObject.FileExists(ctr_fpath) Then set ctr_ActiveFile = ctr_FileObject.opentextfile(ctr_fpath) ctr_counter = trim(ctr_ActiveFile.readline) if not IsNumeric(ctr_counter) then ctr_counter = 0 end if ctr_counter = ctr_counter + 1 ctr_ActiveFile.close Set ctr_ActiveFile = ctr_FileObject.CreateTextFile(ctr_fpath, true) ctr_ActiveFile.WriteLine(ctr_counter) ctr_ActiveFile.Close Else Set ctr_ActiveFile = ctr_FileObject.CreateTextFile(ctr_fpath) ctr_ActiveFile.WriteLine("1") ctr_counter=1 ctr_ActiveFile.Close End If Response.Write "
Viewed " & ctr_counter & " times
" %>