Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15114255
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114256
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114257
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114258
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114259
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114260
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114261
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114262
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114263
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114264
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114265
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114266
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114257
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114268
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114269
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114270
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114271
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114272
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114273
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114274
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114275
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114276
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114277
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114278
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114279
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114280
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114281
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114272
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114284
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114285
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114286
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114287
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114288
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114289
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114290
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114291
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114292
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114293
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114294
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114295
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114296
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114287
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114298
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114299
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114300
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114301
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114302
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114303
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114304
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114305
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114306
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/
完整的访问统计程序(二 程序篇)-剑心通明-ChinaUnix博客

  • 博客访问: 15114307
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: Mysql/postgreSQL

2008-05-30 09:52:14

以下为引用的内容:
baidu

/*
  原创:豆腐
  请大家在转载和使用的时候  保留这条信息
*/
/* dbcn.asp
   创建数据库连接的 公用程序
*/
<%
  function OpenConn()
     '创建数据库连接
     dim ConnStr
     dim uid
     dim pwd
     dim db
     uid="BBC"
     pwd="BBC"
     db="BBC"
     Softserver="Softdepserver"
     Set Conn = Server.CreateObject("ADODB.Connection")
     ConnStr="Provider=SQLOLEDB.1;UID=" & uid & ";PWD=" & pwd & ";database=" & db & ";server=" & Softserver & ""
     
     Conn.Open ConnStr
     
     set OpenConn=Conn
  end function
  
  function OpenRst()
     '创建数据库记录集
     set Rst=Server.CreateObject ("ADODB.Recordset")
     set OpenRst=Rst
  end function
%>
/*
  staticFunc
  统计程序所需要用到的函数库
*/

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        


           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18817) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18816) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18815) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18814) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18813) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18812) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18811) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18810) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18809) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18808) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18807) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18806) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18805) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18804) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18803) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18802) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18801) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18800) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18799) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18798) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18797) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18796) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18795) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18794) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18793) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18792) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18791) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18790) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18789) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18788) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18787) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18786) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18785) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18784) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18783) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18782) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18781) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18780) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18779) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18778) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18777) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18776) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18775) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18774) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18773) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18772) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18771) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18770) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18769) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18768) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18767) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~

<%
   set conn=openConn()
   set rst=openRst()
   sub WriteDateTable(intStart,intEnd,strArray,ccount)
      '生成统计表
      %>
        
           <%for i= intStart to intEnd%>

  


              

              

          
        

           <%next%>
        

<%=strArray(i)%>
              <%
                 if rst.eof then
                    setbar 0,ccount
                 else
                    if rst(1)=i then
                       setbar rst(3),ccount
               if not rst.eof then rst.movenext
                    else
                       setbar 0,ccount
                    end if
                 end if
              %>
              

      <%
   end sub
%>
<%
   sub setBar(num,ccount)
     '生成统计条
     if ccount=0 then
        percent=0
     else
       percent=cInt(num/ccount*10000)/100
     end if   
     strGif="bar.gif"
     %>
       <%=percent%>%
     
       <%=num%>
     
    <%
   end sub
%>
<%
   sub writeDayStatic(userid)
    '生成日统计
   i=0
   dim strArray(100)
   for i=0 to 23
      strArray(i)= cStr(i) & "点--" & cstr(i+1) & "点"
   next
   i=0
   set rst=openRst()
   strSQL="select sum(num) as ccount from dateStatic where userid='" & userid & "'"
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")

  end if
   strSQL="select * from dateStatic where userid='" & userid & "' order by hourid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
%>
访问总数<%=ccount%>


    

       

       

    

<% WriteDateTable 0, 11, strArray ,ccount %><%WriteDateTable 12, 23, strArray ,ccount %>

<%
end sub
%>
<%
   sub writeWeekStatic(userid)
   '生成周统计   
   i=0
   dim strArray(7)
   strArray(0)="星期日"
   strArray(1)="星期一"
   strArray(2)="星期二"
   strArray(3)="星期三"
   strArray(4)="星期四"
   strArray(5)="星期五"
   strArray(6)="星期六"
   i=0
   strSQL="select sum(num) as ccount from weekStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from WeekStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>

访问总数<%=ccount%>
     


       

          

       

    
<% WriteDateTable 0, 6, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeMonthStatic(userid)
   '生成月统计
   i=0
   dim strArray(32)
   for i=1 to  31
     strArray(i)=cStr(i) & "日"
   next
   i=0
   strSQL="select sum(num) as ccount from MonthStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from MonthStatic where userid='" & userid & "' order by dayid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       

  

<% WriteDateTable 1, 16, strArray ,ccount %><% WriteDateTable 17, 31, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub writeYearStatic(userid)
   i=0
   dim strArray(13)
   for i=1 to  12
     strArray(i)=cStr(i) & "月"
   next
   i=0
   strSQL="select sum(num) as ccount from YearStatic where userid='" & userid & "'"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   if isnull(Rst("ccount")) then
     ccount=0
   else
     ccount=Rst("ccount")
   end if
   strSQL="select * from YearStatic where userid='" & userid & "' order by monthid"
   set rst=openRst()
   rst.open strSQL,conn,3,3
   %>
   访问总数<%=ccount%>
     
       
          
          
       
    
<% WriteDateTable 1, 6, strArray ,ccount %><% WriteDateTable 7, 12, strArray ,ccount %>

   <%
   end sub
%>
<%
   sub WriteRecentInfo(userid)
      '显示访问者的浏览器分布
      StrSQL="select top 10 * from accessstat where userid='" & userid & "' order by VisitTime desc"

     set rst=openRst()
      Rst.open StrSQL,Conn,3,1
      %>
      


          

             

             
                 
             

             

             

             

             

          

         <% for i=1 to Rst.RecordCount %>                   
              

                 

                 
                                                              

                


                 

                 
    
                 

                 

               

               <% Rst.MoveNext%>              
     <% Next %>
      
序 号来访时间IP地址所用操作系统所用浏览器类型浏览的上一页
<%=i%><%=Rst("VisitTime")%> <%=Rst("IPAddr")%><%=Rst("UseSystem")%><%=Rst("BrowserType")%>><%Response.Write Rst("LastPage")%>
    
<%
   end su

%>
<%
   sub WriteBrowserInfo(userid)
      Set Rst=OpenRst()
      strSQL="select count(*) as VisitCount from AccessStat where userid='" & userid & "'"
      Rst.open strSQL,Conn,3,1
      TotalVisit=rst(0)
      StrSQL="select BrowserType,count(BrowserType) as visitcount from AccessStat where userid='" & userid & "' group by BrowserType order by VisitCount desc"
      Set Rst=OpenRst()
      Rst.open StrSQL,Conn,3,1
      %>    
      


          

             

             
                 
             

             

             

          

          <%for i=1 to     Rst.RecordCount %>
             

               


                

                
                

                

             

         <%Rst.MoveNext%>
          <% Next %>    
          

序 号所用浏览器类型访问比例尺表示访问次数
<%=i%><%=Rst("BrowserType")%><%setbar Rst("VisitCount"),TotalVisit %>

<%   
   end sub
%>
<%
   sub InsertData(userid)
      '处理浏览者信息
      ExecUserInfo userid
      '处理日统计
      ExecDayStatic userid
      '处理周统计
      ExecWeekStatic userid
      '处理月统计
      ExecMonthStatic userid
      '处理年统计
      ExecYearStatic userid
   end sub
%>
<%
   sub ExecUserInfo(userid)
      '处理浏览者信息
      strRet=Request.ServerVariables("HTTP_USER_AGENT")
      strArray=split(strRet,"(")
      strRet=left(strArray(1),len(strArray(1))-1)
      strArray=split(strRet,";")
      strBrowserName=strArray(1)       '浏览器
      strUseSystem=strArray(2)         '用户操作系统  
      strPrPage=Request.ServerVariables("HTTP_REFERER")     '从何而来
      if strPrPage="" then
         strPrPage="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")

      end if
      strIPAddr=Request.ServerVariables ("REMOTE_ADDR")        '用户IP地址
      strSQL="insert into AccessStat(UserID,VisitTime,IPAddr,UseSystem,BrowserType,LastPage) "
      strSQL=strSQL & "values ('" & trim(userid) & "',getDate(),'" & trim(strIPAddr) & "','"
      strSQL=strSQL & trim(strUseSystem) & "','" & trim(strBrowserName) & "','" & trim(strPrPage) & "')"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecDayStatic(userid)
      '处理每日的小时数据
      strSQL="select * from DateStatic where dateid=datepart(dy,getdate()) and userid='" & userid & "'"
      set rst=openrst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from DateStatic where userid='" & userid & "'"
         conn.execute strSQL
         for i=0 to 23
            strSQL="insert into DateStatic values(datepart(dy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next

     end if
      strSQL="update datestatic set num=num + 1 where dateid=datepart(dy,getdate()) and hourid= datepart(hh,getdate()) and userid='" & userid & "'"
      conn.execute strSQL      
   end sub
%>
<%
   sub ExecWeekStatic(userid)
     '处理每周的日数据
     strSQL="select * from WeekStatic where weekid=datepart(ww,getdate()) and userid='" & userid & "'"
     set rst=openRst()
     rst.open strSQL,conn,3,3
     if rst.eof and rst.bof then
        strSQL="delete from WeekStatic  where userid='" & userid & "'"
        conn.execute strSQL
        for i=0 to 6
           strSQL="insert into WeekStatic values(datepart(ww,getdate())," & cStr(i) & ",'" & userid & "',0)"
           conn.execute strSQL
        next
     end if
     strSQL="update weekstatic set num=num + 1 where weekid=datepart(ww,getdate()) and dayid+1= datepart(dw,getdate())  and userid='" & userid & "'"
     conn.execute strSQL
  end sub
%>
<%
   sub ExecMonthStatic(userid)
      '处理每月的日数据
      strSQL="select * from MonthStatic where monthid=datepart(mm,getdate()) and userid='" & userid & "'"

     set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from MonthStatic  where userid='" & userid & "'"
         conn.execute strSQL
         for i=1 to 31
            strSQL="insert into MonthStatic values(datepart(mm,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update monthstatic set num=num + 1 where monthid=datepart(mm,getdate()) and dayid= datepart(dd,getdate())"
      conn.execute strSQL
   end sub
%>
<%
   sub ExecYearStatic(userid)
     '处理每年的月数据
     strSQL="select * from YearStatic where yearid=datepart(yy,getdate()) and userid='" & userid & "'"
      set rst=openRst()
      rst.open strSQL,conn,3,3
      if rst.eof and rst.bof then
         strSQL="delete from YearStatic where userid='" & userid & "'"
         conn.execute strSQL

       for i=1 to 12
            strSQL="insert into YearStatic values(datepart(yy,getdate())," & cStr(i) & ",'" & userid & "',0)"
            conn.execute strSQL
         next
      end if
      strSQL="update YearStatic set num=num + 1 where Yearid=datepart(yy,getdate()) and Monthid= datepart(mm,getdate()) and userid='" & userid & "'"
      conn.execute strSQL
   end sub
%>

阅读(18766) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~