Statistik
HejsaJeg har været inde på aspcode.net og hente det statistik script som hedder StatMentor og det er såvidt godt nok, men jeg vil gerne kunne lave et diagram som viser fordelingen af besøgende fra dag tildag. Og til det fandt jeg det script jeg har kopieret ind herunder.
********************************************<%
\' ***************************************************************
\' Created 12/20/99, Don Franke
\' ***************************************************************
\' get values
iMonth = Int(Request.Querystring(\"M\"))
iYear = Int(Request.Querystring(\"Y\"))
If iMonth = 0 Then iMonth = Month(Now)
If iYear = 0 Then iYear = Year(Now)
iYSize = 20
\' dimension arrays
Dim aryDay
Dim aryMonth
Dim aryData
\' populate arrays
aryDay = Array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
aryMonth = Array(\"\", \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\")
aryData = Array()
\' redimension data array
For x = 0 to aryDay(iMonth)
ReDim aryData(x)
Next
\' connect to db
Set Conn = CreateObject(\"ADODB.Connection\")
Conn.Open \"datasource\"
\' get count for each day of month
For x = 1 to aryDay(iMonth)
\' set date
sBegDate = iMonth & \"/\" & x & \"/\" & iYear
\' get total from database
sSQL = \"SELECT COUNT(order_number) AS total FROM order_person WHERE date_placed BETWEEN #\" & sBegDate & \" 12:01 AM# AND #\" & sBegDate & \" 11:59 PM#\"
Set rsCount = Conn.Execute(sSQL)
\' add to array
aryData(x) = Int(rsCount(\"total\"))
Next
%>
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<title>Order History</title>
<META NAME=\"Generator\" CONTENT=\"Stone\'s WebWriter 3\">
</head>
<body BGCOLOR=\"#FFFFFF\">
<CENTER>
<FONT FACE=sans-serif>
<H1>Order History</H1>
</FONT>
<HR SIZE=1>
<FONT FACE=sans-serif SIZE=2>
<FORM NAME=\"frmMain\" ACTION=\"aspgraph.asp\">
Select month and year, then click on \'View\' to view history.<BR>
<SELECT NAME=\"M\">
<%For x = 1 to 12
If x = iMonth Then%>
<OPTION VALUE=\"<%=x%>\" SELECTED><%=aryMonth(x)%>
<% Else%>
<OPTION VALUE=\"<%=x%>\"><%=aryMonth(x)%>
<% End If
Next%>
</SELECT>
<SELECT NAME=\"Y\">
<%For x = 1999 to 2000
If x = iYear Then%>
<OPTION VALUE=\"<%=x%>\" SELECTED><%=x%>
<% Else%>
<OPTION VALUE=\"<%=x%>\"><%=x%>
<% End If
Next%>
</SELECT>
<INPUT TYPE=\"SUBMIT\" VALUE=\"View\">
<A HREF=\"admin.htm\">Home</A>
</FORM>
<TABLE BORDER=0>
<TR>
<TD ALIGN=CENTER>O<BR>r<BR>d<BR>e<BR>r<BR>s</TD>
<TD>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=0 WIDTH=650>
<%\' loop through rows
For x = iYSize to 1 Step -1%>
<TR>
<TD BGCOLOR=\"#CCCCCC\" ALIGN=RIGHT><TT><%=x%></TD>
<%\' loop through days of month
For y = 1 to aryDay(iMonth)
If x > aryData(y) Then
sColor = \"#F5F5F5\"
Else
sColor = \"#00CC00\"
End If%>
<TD BGCOLOR=\"<%=sColor%>\" WIDTH=20> </TD>
<%Next%>
<TD BGCOLOR=\"#CCCCCC\" ALIGN=RIGHT><TT><%=x%></TD>
</TR>
<%Next%>
<TR>
<TD BGCOLOR=\"#CCCCCC\" ALIGN=CENTER> </TD>
<%For x = 1 to aryDay(iMonth)%>
<TD BGCOLOR=\"#CCCCCC\" ALIGN=CENTER><TT><%=x%></TD>
<%Next%>
<TD BGCOLOR=\"#CCCCCC\"> </TD>
</TR>
<TR>
<TD COLSPAN=\"<%=aryDay(iMonth) + 2%>\" ALIGN=CENTER>Day of month</TD>
</TR>
</table>
</TD>
</TR>
</TABLE>
</body>
</html>
<%
\' close up shop
Conn.Close
Set Conn = Nothing
%>
********************************************
Statmentor genere nogle filer for hver dag. En af de filer som den generer hedder f.eks. PVSUM_20010128.LOG. Hvordan kan jeg så få ovenstående script til at gå ind og hente de tal som er i PVSUM_XXXXXXXX.LOG filerne.
/mikkel.jor
