如何在统计中加上昨日访问量的输出统计?_动易Cms教程
有的朋友想在统计中加上昨日访问量的输出统计,可以用以下方法(2005版本的ACC和SQL统计均适合):
请在Count/Counter.asp中加上如下代码(红色所示):
If FoundInArr(RegCount_Fill, "IsCountOnline", ",") = True Then
If OnlineTime="" Or isnumeric(OnlineTime)=0 Then OnlineTime=100
OnNowTime = dateadd("s",-OnlineTime,now())
dim rsOnline
if CountDatabaseType="SQL" then
set rsonline = conn_counter.execute("select count(UserIP) from PE_Statonline where LastTime>'"&OnNowTime&"'")
else
set rsonline = conn_counter.execute("select count(UserIP) from PE_Statonline where LastTime>#"&OnNowTime&"#")
end if
OnlineNum = rsonline(0) ' 当前在线人数
Set rsonline=Nothing
if CountDatabaseType="SQL" then
Set rsonline = conn_counter.execute("select LastTime,OnTime from PE_Statonline where LastTime>'"&OnNowTime&"' and UserIP='"&IP&"'")
else
Set rsonline = conn_counter.execute("select LastTime,OnTime from PE_Statonline where LastTime>#"&OnNowTime&"# and UserIP='"&IP&"'")
end if
If rsOnline.eof then
Update()
Else
if rsonline(0)=rsonline(1) Then
Update()
else
conn_counter.Execute("Update PE_StatInfoList set TotalView=TotalView 1")
end if
End If
Set rsonline=Nothing
Else
if instr(Application(LastIPCache),"#" & IP & "#") then ' 假如IP已经存在于保存的列表中,是刷新
conn_counter.Execute("Update PE_StatInfoList set TotalView=TotalView 1")
Else
Application.Lock
Application(LastIPCache)=SaveIP(Application(LastIPCache)) ' 更新最近需要防刷的IP
Application.UnLock
Update()
End If
End If
'--------输出昨日访问量代码开始
Dim nYesterDayNum,CacheData
If CacheIsEmpty("nYesterDayVisitorNum") Then
dim YesterdayStrLong
YesterdayStrLong=year(dateadd("d","-1",date()))&"-"&month(dateadd("d","-1",date()))&"-"&day(dateadd("d","-1",date()))
set rs=server.createobject("adodb.recordset")
If CountDatabaseType="SQL" Then
sql="SELECT * FROM PE_StatDay WHERE TDay='"&YesterdayStrLong&"'"
Else
sql="SELECT * FROM PE_StatDay WHERE TDay=#"&YesterdayStrLong&"#"
End If
rs.Open sql,conn_counter,1,1
If Not rs.BOF or Not rs.EOF then
for i=0 to 23
nYesterDayNum=nYesterDayNum rs(CStr(i))
next
else
nYesterDayNum=0
end if
CacheData = Application("nYesterDayVisitorNum")
If IsArray(CacheData) Then
CacheData(0) = nYesterDayNum
CacheData(1) = Now()
Else
ReDim CacheData(2)
CacheData(0) = nYesterDayNum
CacheData(1) = Now()
End If
Application.Lock
Application("nYesterDayVisitorNum") = CacheData
Application.UnLock
Else
CacheData = Application("nYesterDayVisitorNum")
If IsArray(CacheData) Then
nYesterDayNum = CacheData(0)
Else
nYesterDayNum = 0
End If
End If
- MAC错误的解决方法
- 如何屏蔽动易后台导航里的某个功能菜单?
- 动易.NET版本留言自动选定栏目方法
- 动易SiteFactoty整合Discuz!NT3.0
- 在任意位置获取根节点ID标签
- 如何开启SiteWeaver6.8的支持,反对功能
- Windows 2008安装动易.NET系统之四----动易系统安装篇
- Windows 2008安装动易.NET系统之三----数据库篇
- Windows 2008安装动易.NET系统之二----IIS、目录环境配置篇
- 数据库修复,SQL Server 2005内部操作不一致的处理
- 如何安装动易.net程序权限配置
- 为什么提示对Windows系统文件夹下的Temp目录没有访问权限?
- 相关链接:
- 教程说明:
动易Cms教程-如何在统计中加上昨日访问量的输出统计?。