% Response.Buffer = True If Session("statmentor_date1") = "" Then Response.Redirect "selectperiod_2.asp" End If %> <% Dim sortdata sortdata = Request("MLS") Const File_OpenForReading = 1, File_OpenForWriting = 2, File_OpenForAppending = 8 Function GetStatDir() GetStatDir = Server.MapPath("/ctrfiles/stats/") If Right(GetStatDir,1) <> "/" Or Right(GetStatDir,1) <> "\" Then GetStatDir = GetStatDir & "\" End If End Function Function GetFormattedDate( dDate ) Dim sMonth, sDay sMonth = DatePart( "m", dDate) If Len(sMonth) = 1 Then sMonth = "0" & sMonth End If sDay = DatePart( "d", dDate) If Len(sDay) = 1 Then sDay = "0" & sDay End If GetFormattedDate = DatePart( "yyyy", dDate ) & sMonth & sDay End Function Function File_OpenExistingOrCreate( strPath, nAccess ) On Error Resume Next Dim objFileObj Dim objFile Set objFileObj = Server.CreateObject("Scripting.FileSystemObject") Set objFile = objFileObj.OpenTextFile( strPath, nAccess, True, False ) If Err = 0 Then Set File_OpenExistingOrCreate = objFile Else Set File_OpenExistingOrCreate = Nothing End If End Function Sub AddPageViews( sFileName, ByRef oDictionary ) Dim oFile, sText Set oFile = File_OpenExistingOrCreate( GetStatDir() & sFileName , File_OpenForReading ) While Not oFile.AtEndOfStream sText = oFile.ReadLine() & "," & Mid(sFileName,8,8) If sText <> "" Then If oDictionary.Exists(sText) Then oDictionary.Item(sText) = oDictionary.Item(sText) + 1 Else oDictionary.Add sText, 1 End If End If Wend End Sub Function GetPageViewCount2( dDate1, dDate2 ) Dim oRet Set oRet = Server.CreateObject("Scripting.Dictionary") If dDate1 = "" Then dDate1 = "1900-01-01" End If If dDate2 = "" Then dDate2 = "2020-01-01" End If Dim sName1, sName2 sName1 = "PVPAGE_" & GetFormattedDate( dDate1 ) & ".log" sName2 = "PVPAGE_" & GetFormattedDate( dDate2 ) & ".log" Dim fs, f, f1, fc, s Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder(GetStatDir()) Set fc = f.Files For Each f1 in fc If Left( f1.name,7) = "PVPAGE_" Then If f1.name >= sName1 AND f1.name <= sName2 Then AddPageViews f1.name, oRet End If End If Next Set GetPageViewCount2 = oRet End Function Function GetCount( dDate1, dDate2 ) Dim markercount,counter,filedate,filedatename,oKey2,oKey,newkey,newkey2,strfilter,daysum,totalsum markercount = 1 Set oDict = GetPageViewCount2(Session("statmentor_date1") , Session("statmentor_date2") ) daysum = 0 counter = 0 For Each oKey In oDict.Keys newkey = Split(oKey,",") IF marker <> newkey(1) Then filedate = Mid(newkey(1),5,2) & "/" & Right(newkey(1),2) filedatename = WeekdayName(Weekday(filedate)) Response.Write("" & chr(13)) Response.Write("" & chr(13)) For Each oKey2 In oDict.Keys newkey2 = Split(oKey2,",") strfilter = StrReverse(newkey2(0)) strfilter = Mid(strfilter,5,Len(strfilter)) strfilter = Left(strfilter,Instr(1,strfilter, "/",1) - 1) strfilter = StrReverse(strfilter) If strfilter = sortdata AND newkey(1) = newkey2(1) Then daysum = daysum + oDict.Item(oKey2) totalsum = totalsum + oDict.Item(oKey2) counter = counter + 1 End if Next Response.Write("" & chr(13)) daysum = 0 markercount = markercount + 1 End if marker = newkey(1) Next Response.Write("") Response.Write("
" & totalsum & " Total Hits for the Period of: " & Session("statmentor_date1") & " To " & Session("statmentor_date2") & " With an average of: " & Round(totalsum / counter,2) & " Per day " & Round(totalsum / counter / 24,2) & " Per Hour " & Round(totalsum / counter / 1440,2) & " Per Minute |
| <%=straddress%> |
<%=strtitle%> Stats |
||||||
|
|||||||