<% dt=Date() dd=Day(dt) mm=Month(dt) yy=Year(dt) newdate=dd & "/" & mm & "/" & yy session.TimeOut=100 session("strdate")=newdate 'To append the visit date & time to "visitlog.txt" Dim objopenfile, objfso, strpath logcount=session("hit_counter") if session("hit_counter")="" then Const forappending = 8 Const forreading = 1 Const ForWriting = 2 'TO UPDATE & DISPLAY THE VISIT COUNTER 'logcounter.txt' strpath = Server.MapPath("visit/logcounter.txt") Set objfso = Server.CreateObject("Scripting.FileSystemObject") If objfso.FileExists(strpath) Then Set objopenfile = objfso.OpenTextFile(strpath, forreading) logcount = Clng(objopenfile.readline) + 1 objopenfile.Close Else logcount = 1000 End if session("hit_counter")=logcount session("neworderid")=logcount logcount=session("hit_counter") Set objopenfile = objfso.CreateTextFile(strpath, True) objopenfile.WriteLine(logcount) objopenfile.Close 'TO UPDATE VISITOR LOG EVENT FILE (visitlog.txt) strpath = Server.MapPath("visit/visitlog.txt") Set objfso = Server.CreateObject("Scripting.FileSystemObject") If objfso.FileExists(strpath) Then Set objopenfile = objfso.OpenTextFile(strpath, forreading) objopenfile.Close Set objopenfile = objfso.OpenTextFile(strpath, forappending) Else Set objopenfile = objfso.CreateTextfile(strpath) objopenfile.WriteLine("Visitor Log events") End if logtime = Time() logdate = newdate week_num = weekday(Date) If week_num = 1 Then week_day = "Sunday" ElseIf week_num = 2 Then week_day = "Monday" ElseIf week_num = 3 Then week_day = "Tuesday" ElseIf week_num = 4 Then week_day = "Wednesday" ElseIf week_num = 5 Then week_day = "Thursday" ElseIf week_num = 6 Then week_day = "Friday" ElseIf week_num = 7 Then week_day = "Saturday" Else week_day = "Sorry" End if session("strday")=week_day remote_host = Request.ServerVariables("REMOTE_HOST") remote_addr = Request.ServerVariables("REMOTE_ADDR") url = Request.ServerVariables("URL") http_referer = Request.ServerVariables("HTTP_REFERER") clienthost = Request.ServerVariables("HTTP_HOST") clientbrowser = Request.ServerVariables("HTTP_USER_AGENT") logwrite = logcount & " => " & week_day & ", " & logdate & ", at " & logtime & ", IP-" & remote_addr 'objopenfile.ClearAll objopenfile.WriteLine(logwrite) 'objopenfile.WriteLine(prestrtext) objopenfile.Close Set objopenfile = Nothing Set objfso = Nothing end if %>
<%=logcount%>