您好,欢迎来到点滴吧! 手机版
点滴吧www.diandiba.com
记录点点滴滴,尽在点滴吧
  • 文章
  • 文章
  • 特效
  • 素材
  • 景点
您现在的位置:首页 > 动易 > 文章正文
ASP读取动易网站访问量统计代码
更新时间:2015/1/4 18:34:31   点击:3356次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href='/Skin/DefaultSkin.css' rel='stylesheet' type='text/css'>
</head>
<body>
<%
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<!--#include file="Conn_Counter.asp"-->
<!--#include file="../Include/PowerEasy.Common.Security.asp"-->
<%
Call OpenConn_Counter

Dim Sql, Rs
Set Rs = Conn_Counter.Execute("select * from PE_StatInfoList")
If Not Rs.BOF And Not Rs.EOF Then
    RegCount_Fill = Rs("RegFields_Fill")
    OnlineTime = Rs("OnlineTime")
    VisitRecord = Rs("VisitRecord")
    KillRefresh = Rs("KillRefresh")
    DayNum = Rs("DayNum")
    AllNum = Rs("TotalNum") + Rs("OldTotalNum")
    TotalView = Rs("TotalView") + Rs("OldTotalView")
    StartDate = Rs("StartDate")
    StatDayNum = DateDiff("D", StartDate, Date) + 1
    If StatDayNum <= 0 Or IsNumeric(StatDayNum) = 0 Then
        AveDayNum = StatDayNum
    Else
        AveDayNum = CLng(AllNum / StatDayNum)
    End If
End If
Set Rs = Nothing

Function GetYesterdayNum()
    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
End Function

Function CacheIsEmpty(MyCacheName)
    CacheIsEmpty = True
    CacheData = Application(MyCacheName)
    If Not IsArray(CacheData) Then Exit Function
    If Not IsDate(CacheData(1)) Then Exit Function
    If DateDiff("s", CDate(CacheData(1)), Now()) < 60 * 1440 Then
        CacheIsEmpty = False
    End If
End Function

Call GetYesterdayNum
%>
今日访问:<%=DayNum%>
昨日访问:%=nYesterDayNum%>
总访问量:<%=AllNum%>
总浏览量:<%=TotalView%>
日均访问:<%=AveDayNum%>
</body>
</html>
相关文章
导航分类
热门文章
关于我们| 联系我们| 免责声明| 网站地图|
CopyRight 2012-2015 www.diandiba.com - 点滴吧 All Rights Reserved
滇ICP备09005765号-2