<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% startime=timer() %>
<!--#include file="../conn/cls_wry.asp"-->
<!--#include file="inc.asp"-->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站统计</title>
<meta http-equiv="refresh" content="60">
<link href="style/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="draw.js"></script>
<!--#include file="showit.js" -->
<style type="text/css">
<!--
.style3 {
	font-size: 7pt;
	color: #F75D31;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-size: 12px;
}
.style4 {
	color: #990000;
	font-weight: bold;
	
}
.copyright {
	PADDING-RIGHT: 1px; BORDER-TOP: #6595d6 1px dashed; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; FONT: 11px verdana,arial,helvetica,sans-serif; COLOR: #4455aa; PADDING-TOP: 1px; TEXT-DECORATION: none
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body bgcolor="#C4D8ED">

<table width="760"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr align="center"> 
    <td width="760" height="3" colspan="2"><img src="images/topline.gif" width="760" height="3"></td>
  </tr>
  <tr align="center"> 
    <td height="3" colspan="2" align="right" bgcolor="#E1ECF2"><table  border="0" cellpadding="5" cellspacing="0">
        <tr align="center"> 
          <td height="18" nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">◆</span> 
            <a href="index.asp?act=main">简要数据</a></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">◆</span> 
            <a href="index.asp?act=hour">小时</a></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">◆</span> 
            <a href="index.asp?act=day">日</a></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">◆</span> 
            <a href="index.asp?act=month">月</a></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><p><span class="style3">◆</span> 
              <a href="index.asp?act=osexp">系统/浏览器</a></p></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">◆</span> 
            <a href="index.asp?act=where">地区</a></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">◆</span> 
            <a href="index.asp?act=referer">来源</a></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">◆</span> 
            <a href="index.asp?act=last20">来访者</a></td>
          <td nowrap onMouseOver="this.style.backgroundColor='#E1ECF2';" onMouseOut="this.style.backgroundColor='';"><span class="style3">●</span> 
            <a href="websen_long.asp">初始数据</a></td>
        </tr>
      </table></td>
  </tr>
</table>
<br>
<%	
	

		act = Request("act")

	if act = "" then act="main"

	Select Case act
			
		Case "main" 
			Call Sb_Main()
		
		Case "hour"

			Call Sb_Hour()
		
		Case "day"
			Call Sb_Day()
			
		Case "month"
			Call Sb_Month()
		
		Case "osexp"
			Call Sb_OsExp()

		Case "where"
			Call Sb_Where()
		
		Case "referer"
			Call Sb_Referer()
		
		Case "last20"
			Call Sb_Last20()
			
		Case Else
			Response.Write("错误！")
			Response.End
	End Select
		
%>
<p>
<%
'程序开始
	Sub Sb_Main()
	
		'取得基本资料
		vSql = "select WebName,WebUrl,WebExp,WebEmail,WebMaster,WebCountTime from websen_webinfo"
		Set vRs = GetRs(vsql)
		if Not vRs.Eof then
			WebName = vRs("WebName")
			WebUrl = vRs("WebUrl")
			WebExp = vRs("WebExp")
			WebEmail = vRs("WebEmail")
			WebMaster = vRs("WebMaster")
			WebCountTime = vRs("WebCountTime")
		else
			Response.Redirect("index.asp?act=admin")
		end if
		vRs.close
		'统计总人数
		vSql = "select Sum(cCMC) as vCount from websen_cM"
		Set vRs = GetRs(vsql)
		vCount=vRs("vCount")
		vRs.Close
		'统计今日访问量和计算今日访问量预测
		vCha = Now()-Date()
		vSql = "select cTDC from websen_cD where cDay ="&day(date())
		Set vRs = GetRs(vSql)
		vToday = vRs("cTDC")
		vYToday = Round(vToday/vCha *(1-vCha) + vToday)
		vRs.close
		'统计天数和平均日访问量
		vCDate = date()-cDate(WebCountTime)
		if vCDate=0 then 
		vAveCount = 0
		else
		vAveCount = Round((vCount-vToday)/vCDate)
		End IF
		
		'年访问量和月访问量

		vSql = "select cTMC from websen_cM where cMonth="&Month(Now())&""
		'vsql="select cTMC from websen_cM where cMonth=datepart(mm,getdate())"
		Set vRs = GetRs(vSql)
		vMCount = vRs("cTMC")
		vRs.close
		vsql = "select refurbish from websen_flux where id=1"
		set vRs = GetRs(vsql)
		vref = vRs("refurbish")
		vRs.close
		if vflux > 1024 then
		 vflux = cStr(FormatNumber(vflux / 1024,0,-1,-1)) & " K" 
		else
		 vflux = cStr(vflux) & " 字节"
		end if
		str = "<br><table width=90% border=0 cellpadding=2><tr><td>总访问人数：</td><td width=41% >"&vCount&"</td><td width=14% >开始统计日期：</td><td width=31% >"&WebCountTime&"</td></tr><tr><td>今日访问量：</td><td>"&vToday&"</td><td>本月访问量：</td><td>"&vMCount&"</td></tr><tr><td>统计天数：</td><td>"&vCDate&"</td><td>平均日访问量：</td><td>"&vAveCount&"/"&vCount&"/"&vToday&"/"&vCDate&"</td></tr><td nowrap>整站页面刷新：</td><td>"&vref&"</td><td nowrap>预计本日访问量：</td><td>"&vYToday&"</td></tr></table>"
		
		Call DrawTable("网站统计简要信息",str)
	%>
</p>
<p> 
  <%
	End Sub
	Dim aHour
	Dim MaxHour
	Dim sImage
	Dim SAimage
	Sub Sb_Hour()
		'取的当前小时数
		vHour = hour(now())
		'循环取最近24小时的访问人数
		Conn.execute "update websen_cH set cTHC=0,HMD=GetDate() where DATEDIFF(hh,HMD,GetDate()) > 23 " 

		MaxHour = 0	 
		vSql = "select websen_cH.cHour,websen_cH.cTHC,MaxNum.MaxCount from websen_cH,(select Max(cTHC) as MaxCount from websen_cH) as MaxNum order by websen_cH.cHour asc"
		Set vRs = GetRs (vSql)
		Dim aHour(23)
		for i=0 to ubound(aHour)
			aHour(i) = vRs("cTHC")
			MaxHour = vRs("MaxCount")
			vRs.MoveNext
		next
			
		'算出图例最大值的比例
		if MaxHour = 0 then MaxHour = 1
		vPoint = 100/MaxHour
		k=0
		avgcount=0
		sImage = "<table border=0 cellpadding=2><tr><td align=center>最近24小时统计图表</td></tr><tr><td align=center><table align=center><tr valign=bottom ><td valign=top><table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" height=""100""><tr><td height=""25"" valign=top nowrap>"&MaxHour&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxHour*0.75&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxHour*0.5&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxHour*0.25&"</td></tr></table></td>"
		for vPH = vHour+1 to  23
			k = k+1
			sHeight = aHour(vPH)*vPoint
			avgcount = avgcount + aHour(vPH)
			avgheight = (avgcount/k)*vPoint
			sImage = sImage & "<td align=center width=15 background=images/tu_back.gif height=120 nowrap><img src=images/bar.gif width=15 height="&sheight&" id=htav avgheight="&avgheight&" title=访问量："&aHour(vPH)&"><br>"&vPH&"</td>"
			
		next
		for vBH = 0 to  vHour
			k = k+1
			sHeight = aHour(vBH)*vPoint
			avgcount = avgcount + aHour(vBH)
			avgheight = (avgcount/k)*vPoint
			sImage = sImage & "<td align=center width=15 background=images/tu_back.gif height=120 nowrap><img src=images/bar.gif width=15 height="&sheight&" id=htav  avgheight="&avgheight&" title=访问量："&aHour(vBH)&"><br>"&vBH&"</td>"
			
		next
		sImage = sImage & "<td>单位（点）</td></tr></table></td></tr></table>"
		
		'取出所有24小四的统计图表
		vSql = "select websen_cH.cHour,websen_cH.cCHC,MaxNum.MaxCount from websen_cH,(select Max(cCHC) as MaxCount from websen_cH) as MaxNum order by websen_cH.cHour asc"
		Set vRs = GetRs(vSql)
		MaxHour = 0
		for i=0 to ubound(aHour)
			aHour(i) = vRs("cCHC")
			MaxHour = vRs("MaxCount")
			vRs.MoveNext
		next

		'算出图例最大值的比例
		if MaxHour = 0 then MaxHour = 1
		vPoint = 100/MaxHour
		sImage = sImage & "<table border=0 cellpadding=2><tr><td align=center>访问量24小时分配图表</td></tr><tr><td align=center><table align=center><tr valign=bottom ><td valign=top><table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" height=""100""><tr><td height=""25"" valign=top nowrap>"&MaxHour&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxHour*0.75&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxHour*0.5&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxHour*0.25&"</td></tr></table></td>"
		for vL = 0 to 23
			sHeight = aHour(vL)*vPoint
			sImage = sImage & "<td align=center width=15 background=images/tu_back.gif height=120 nowrap><img src=images/bar.gif width=15 height="&sheight&"  title=访问量："&aHour(vL)&"><br>"&vL&"</td>"
			
		next
		sImage = sImage & "<td>单位（点）</td></tr></table></td></tr></table>"
		
		Erase aHour   '释放掉数组
		
		Call DrawTable("24小时统计信息",sImage)
%>
</p>
<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">
  drawavg();
</SCRIPT>
<p> 
  <%
	End Sub
	Dim sADImage,sDImage
	Sub Sb_day()
		vDay = day(now())
		'循环取最近24小时的访问人数
		
		MaxCDay = 0	
		MaxDay = Fn_MaxDay(Month(DateAdd("m",-1,now())))
		Conn.execute "update websen_cD set cTDC=0,DMD=GetDate() where DATEDIFF(dd,DMD,GetDate()) > "&MaxDay
		Dim aDay(31)
			vSql = "select websen_cD.cDay,websen_cD.cTDC,MaxNum.MaxCount from websen_cD,(select Max(cTDC) as MaxCount from websen_cD) as MaxNum order by websen_cD.cDay asc"
			Set vRs = GetRs(vSql)
		for i=1 to Ubound(aDay)
			aDay(i) = vRs("cTDC")
			MaxCDay = vRs("MaxCount")
			vRs.MoveNext
			if vRs.eof then exit for
		next
		'算出图例最大值的比例
		if MaxCDay = 0 then MaxCDay = 1
		vPoint = 100/MaxCDay
		k=0
		avgcount=0
		sDImage = "<table border=0 cellpadding=2><tr><td align=center>最近30天统计图表</td></tr><tr><td align=center><table align=center><tr valign=bottom ><td valign=top><table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" height=""100""><tr><td height=""25"" valign=top nowrap>"&MaxCDay&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxCDay*0.75&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxCDay*0.5&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxCDay*0.25&"</td></tr></table></td>"
		for vL = vDay+1 to MaxDay
			k=k+1
			sHeight = aDay(vL)*vPoint
			avgcount = avgcount + aDay(vL)
			avgheight = (avgcount/k)*vPoint
			sDImage = sDImage & "<td align=center width=15 background=images/tu_back.gif height=120 nowrap><img src=images/bar.gif width=15 height="&sheight&" id=htav  avgheight="&avgheight&"  title=访问量："&aDay(vL)&"><br>"&vL&"</td>"
			
		next
		for vL = 1 to vDay
			k=k+1
			sHeight = aDay(vL)*vPoint
			avgcount = avgcount + aDay(vL)
			avgheight = (avgcount/k)*vPoint
			sDImage = sDImage & "<td align=center width=15 background=images/tu_back.gif height=120 nowrap><img src=images/bar.gif width=15 height="&sheight&" id=htav  avgheight="&avgheight&"  title=访问量："&aDay(vL)&"><br>"&vL&"</td>"
			
		next
		sDImage = sDImage & "</tr></table></td></tr></table>"
		'取出所有24小四的统计图表
	 	MaxDay = Fn_MaxDay(Month(Now()))-1

		MaxCDay = 0
			vSql = "select websen_cD.cDay,websen_cD.cCDC,MaxNum.MaxCount from websen_cD,(select Max(cCDC) as MaxCount from websen_cD) as MaxNum order by websen_cD.cDay asc"
			Set vRs = GetRs(vSql)
		for i=1 to Ubound(aDay)
			aDay(i) = vRs("cCDC")
			MaxCDay = vRs("MaxCount")
			vRs.MoveNext
			if vRs.eof then exit for
		next
		vRs.close
		'算出图例最大值的比例
		if MaxCDay = 0 then MaxCDay = 1
		vPoint = 100/MaxCDay
		sDImage = sDImage & "<table border=0 cellpadding=2><tr><td align=center>访问量各天分配图表</td></tr><tr><td align=center><table align=center><tr valign=bottom ><td valign=top><table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" height=""100""><tr><td height=""25"" valign=top nowrap>"&MaxCDay&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxCDay*0.75&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxCDay*0.5&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxCDay*0.25&"</td></tr></table></td>"
		for vL = 1 to 31
			sHeight = aDay(vL)*vPoint
			sDImage = sDImage & "<td align=center width=15 background=images/tu_back.gif height=120 nowrap><img src=images/bar.gif width=15 height="&sheight&" title=访问量："&aDay(vL)&"><br>"&vL&"</td>"
			
		next
		sDImage = sDImage & "</tr></table></td></tr></table>"
		
		Erase aDay
		
		Call DrawTable("按日统计信息",sDimage)

%>
</p>
<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">
  drawavg();
</SCRIPT>
<p> 
  <%
	End Sub
	Dim sMImage,sAMImage
	Sub Sb_Month()
				'取的当前小时数
		vMonth = Month(now())
		Conn.execute "update websen_cM set cTMC=0,MMD=GetDate() where DATEDIFF(mm,MMD,GetDate()) > 11 " 
		Dim aMonth(12)
		MaxMonth = 0
		'循环取最近24小时的访问人数
		vSql = "select websen_cM.cMonth,websen_cM.cTMC,MaxNum.MaxCount from websen_cM,(select Max(cTMC) as MaxCount from websen_cM) as MaxNum order by websen_cM.cMonth asc"
		Set vRs = GetRs(vSql)
		for vS=1 to 12
			aMonth(vS) = vRs("cTMC")
			MaxMonth = vRs("MaxCount")
			vRs.MoveNext
   		next
		vRs.close
		'算出图例最大值的比例
		if MaxMonth = 0 then MaxMonth = 1
		vPoint = 100/MaxMonth
		sMImage = "<table border=0 cellpadding=2><tr><td align=center>最近12个月统计图表</td></tr><tr><td align=center><table align=center><tr valign=bottom ><td valign=top><table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" height=""100""><tr><td height=""25"" valign=top nowrap>"&MaxMonth&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxMonth*0.75&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxMonth*0.5&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxMonth*0.25&"</td></tr></table></td>"
		for vL = vMonth+1 to 12
			sHeight = aMonth(vL)*vPoint
			sMImage = sMImage & "<td align=center width=15 background=images/tu_back.gif height=120><img src=images/bar.gif width=15 height="&sheight&"  title=访问量："&aMonth(vL)&"><br>"&vL&"</td>"
			
		next
		for vL = 1 to vMonth
			sHeight = aMonth(vL)*vPoint
			sMImage = sMImage & "<td align=center width=15 background=images/tu_back.gif height=120><img src=images/bar.gif width=15 height="&sheight&"  title=访问量："&aMonth(vL)&"><br>"&vL&"</td>"
			
		next
		sMImage = sMImage & "<td>单位（月）</td></tr></table></td></tr></table>"

		'取出所有24小四的统计图表
		sMonth = ""
		MaxMonth = 0
		vSql = "select websen_cM.cMonth,websen_cM.cCMC,MaxNum.MaxCount from websen_cM,(select Max(cCMC) as MaxCount from websen_cM) as MaxNum order by websen_cM.cMonth asc"
		Set vRs = GetRs(vSql)
		for vS=1 to Ubound(aMonth)
			aMonth(vS) = vRs("cCMC")
			MaxMonth = vRs("MaxCount")
			vRs.MoveNext
   		next
		vRs.close
		'算出图例最大值的比例
		if MaxMonth = 0 then MaxMonth = 1
		vPoint = 100/MaxMonth
		sMImage = sMImage & "<table border=0 cellpadding=2><tr><td align=center>访问量12个月分配图表</td></tr><tr><td align=center><table align=center><tr valign=bottom ><td valign=top><table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" height=""100""><tr><td height=""25"" valign=top nowrap>"&MaxMonth&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxMonth*0.75&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxMonth*0.5&"</td></tr><tr><td  height=""25"" valign=top nowrap>"&MaxMonth*0.25&"</td></tr></table></td>"
		for vL = 1 to 12
			sHeight = aMonth(vL)*vPoint
			sMImage = sMImage & "<td align=center width=15 background=images/tu_back.gif height=120><img src=images/bar.gif width=15 height="&sheight&"  title=访问量："&aMonth(vL)&"><br>"&vL&"</td>"
			
		next
		sMImage = sMImage & "<td>单位（月）</td></tr></table></td></tr></table>"

		'年份～

		Call DrawTable("按月统计信息",sMimage)


%>
</p>
<p> 
  <%
		
	End Sub

	Dim sOsImage,sExpImage,sScrImage
	Sub Sb_OSExp()
		MaxValue = 0
	'系统
		oSql = "select websen_cO.cOS,websen_cO.cCOC,MaxNum.MaxCount from websen_cO,(select Max(cCOC) as MaxCount from websen_cO) as MaxNum order by websen_cO.cCOC desc"

		Set oRs = GetRs(oSql)
		dim aOS(6,1)
		for i=0 to 6
			aOS(i,0) = oRs("cOS")
			aOS(i,1) = oRs("cCOC")
			MaxValue = oRs("MaxCount")
			oRs.MoveNext
		next
		oRs.close

		if MaxValue = 0 then MaxValue = 1
		vPoint = 150/MaxValue
	
		sImage = "<table border=0 cellpadding=2><tr><td width=50% align=center>系统统计图表</td><td width=50% align=center>浏览器统计图表</td></tr><tr valign=top><td height=22 align=center><table align=center>"

		for vL = 0 to 6
			sHeight = aOs(vL,1)*vPoint
			sImage = sImage & "<tr valign=cente><td align=right nowap>"&aOs(vL,0)&"</td><td align=left background=images/tu_back_2.gif valign=middle width=150><img src=images/bar2.gif width="&sheight&" height=15  title=访问量："&aOs(vL,1)&"></td><td nowap>"&aOs(vL,1)&"</td></tr>"
			
		next
		sImage = sImage & "</table></td><td align=center>"
		'浏览器
		oSql = "select websen_cE.cExplorer,websen_cE.cCEC,MaxNum.MaxCount from websen_cE,(select Max(cCEC) as MaxCount from websen_cE) as MaxNum order by websen_cE.cCEC desc"

		Set oRs = GetRs(oSql)
''
		dim aExp(6,1)
		for i=0 to 6
			aExp(i,0) = oRs("cExplorer")
			aExp(i,1) = oRs("cCEC")
			MaxValue = oRs("MaxCount")
			oRs.Movenext
		next
		if MaxValue = 0 then MaxValue = 1
		vPoint = 150/MaxValue

		sImage = sImage & "<table align=center>"

		for vL = 0 to 6
			sHeight = aExp(vL,1)*vPoint
			sImage = sImage & "<tr valign=bottom ><td align=right nowap>"&aExp(vL,0)&"</td><td align=left background=images/tu_back_2.gif valign=middle width=150><img src=images/bar2.gif width="&sheight&" height=15  title=访问量："&aExp(vL,1)&"></td><td nowap>"&aExp(vL,1)&"</td></tr>"
			
		next
		sImage = sImage & "</table></td></tr></table>"
		call DrawTable("按操作系统和浏览器统计",sImage)	
%>
</p>
<p>
  <%
	End Sub

	Dim sWhereImage
	Sub Sb_Where()
		MaxValue = 0
		oSql = "select websen_cW.cWhere,websen_cW.cCWC,MaxNum.MaxCount from websen_cW,(select Max(cCWC) as MaxCount from websen_cW) as MaxNum order by websen_cW.cCWC desc"
		vI = cLng(request("AbsolutePage"))
		if vI <= 0 then vI=1
		Set oRs = GetRs(oSql)
		if not oRs.eof then
		oRs.Pagesize = 20
		Dim aWhere(19,1)
		vPageCount = oRs.PageCount
			oRs.AbsolutePage = vI
			For vJ = 1 to oRs.PageSize
				aWhere(vJ-1,0) = oRs("cWhere")
				aWhere(vJ-1,1) = oRs("cCWC")
				MaxValue = oRs("MaxCount")
				oRs.MoveNext
				if oRs.eof then exit for			
			next

			page = PageSplit(vI,vPageCount,"where")
		oRs.close
		else
			page = "暂无数据"
			exit sub
		end if

		if MaxValue = 0 then MaxValue = 1
		vPoint = 150/MaxValue

		sWhereImage = "<table width=100% border=0 cellpadding=2><tr><td align=center>访问者统计图表</td></tr><tr><td align=center><table align=center>"

		for vL = 0 to 19
			sHeight = aWhere(vL,1)*vPoint
			if sHeight=0 then exit for
			sWhereImage = sWhereImage & "<tr valign=bottom ><td nowap>"&aWhere(vL,0)&"</td><td align=left background=images/tu_back_2.gif valign=middle width=150><img src=images/bar2.gif width="&sheight&" height=15  title=访问量："&aWhere(vL,1)&"></td><td nowap>"&aWhere(vL,1)&"</td></tr>"
			
		next

		sWhereImage = sWhereImage & "</table><br>"
		sWhereImage = sWhereImage & page & "</td></tr></table>"
		
		call DrawTable("访问者地区统计",sWhereImage)
%>
</p>
<p>
<%
  end Sub
  
  	Dim sReImage
	Sub Sb_Referer()
		MaxValue = 0
		oSql = "select websen_cR.cReferer,websen_cR.cCRC,MaxNum.MaxCount from websen_cR,(select Max(cCRC) as MaxCount from websen_cR) as MaxNum order by websen_cR.cCRC desc"
		vI = cLng(request("AbsolutePage"))
		if vI <= 0 then vI=1
		Set oRs = GetRs(oSql)
		if not oRs.eof then
		oRs.Pagesize = 20
		Dim aWhere(19,1)
		vPageCount = oRs.PageCount
			oRs.AbsolutePage = vI
			For vJ = 1 to oRs.PageSize
				aWhere(vJ-1,0) = oRs("cReferer")
				aWhere(vJ-1,1) = oRs("cCRC")
				MaxValue = oRs("MaxCount")
				oRs.MoveNext
				if oRs.eof then exit for			
			next

			page = PageSplit(vI,vPageCount,"referer")
		oRs.close
		else
			page = "暂无数据"
			exit sub
		end if

		if MaxValue = 0 then MaxValue = 1
		vPoint = 150/MaxValue

		sReImage = "<table width=100% border=0 cellpadding=2><tr><td align=center>访问者来源统计图表</td></tr><tr><td align=center><table align=center>"

		for vL = 0 to 19
			sHeight = aWhere(vL,1)*vPoint
			if sHeight=0 then exit for
			sReImage = sReImage & "<tr valign=bottom ><td nowap><a href='"&aWhere(vL,0)&"' target=_blank title='"&aWhere(vL,0)&"'>"&Mid(aWhere(vL,0),1,27)&"</a></td><td align=left background=images/tu_back_2.gif valign=middle width=150><img src=images/bar2.gif width="&sheight&" height=15  title=访问量："&aWhere(vL,1)&"></td><td nowap>"&aWhere(vL,1)&"</td></tr>"
			
		next

		sReImage = sReImage & "</table><br>"
		sReImage = sReImage & page & "</td></tr></table>"
		
		call DrawTable("访问者来源统计",sReImage)
%>
</p>
<p>
<%
  end Sub
  
  	Dim ShowMess
  	Sub Sb_Last20()
	
		vSql = "select  * from websen_Last20Vister order by cCT desc,id asc"
		Set Rs = GetRs(vSql)
		
		rs.pagesize=5 
if rs.eof then
response.Write"<br><br><div align='center'>暂无数据信息</div><br><br>"
else
pagecu=rs.recordcount 
pages=rs.pagecount
rs.movefirst
nowpage=request("page") '用request获取当前页数，注意page是自己定义的变量并非函数
if nowpage&"x"="x" then '处理页码为空时的情况
nowpage=1
else
nowpage=cint(nowpage) '将页码转换成数字型
end if
rs.absolutepage=nowpage '将指针移动到当前显示页的第一条记录

	response.Write "<table border=0 cellpadding=2 cellspacing=1 align=center  width='90%'><tr  bgcolor=#CDDDF1><td width=12% >时间</td><td width=13% >操作系统</td><td width=21% >浏览器</td><td width=11% >地区</td><td width=16% >IP地址</td><td width=100% >来源</td></tr>"
	

icolor=1
while not rs.eof and icolor<=rs.pagesize


response.Write"<tr align=center><td width=""12%"">"&month(Rs("cCT"))&"-"&day(Rs("cCT"))&" "&formatdatetime(Rs("cCT"),4)&"</td><td  width=""13%"">"&Rs("cCOS")&"</td><td width=""21%"">"&Rs("cCEXP")&"</td><td width=""11%"">"&Rs("cCW")&"</td><td width=""16%"">"&Rs("cCIP")&"</td><td width=""40%"" align=left><a href="""&Rs("cCR")&""" target=_blank  title="""&Rs("cCR")&""">"&Mid(Rs("cCR"),1,28)&"..</a></td></tr>"&chr(13)	

	
icolor=icolor+1
rs.movenext
wend
end if%>
		</table>
  <span style=" float:right">共:<%=pages%>页 &nbsp;当前为:<%=nowpage%>页
  <%if nowpage>1 then%>
 <a href="index.asp?act=last20&page=<%=nowpage-1%>" >上一页</a>
  <%else%>
上一页
<%end if%>
<%for k=1 to pages%>
<%if k<>nowpage then %>
<a href="index.asp?act=last20&page=<%=k%>"><%=k%></a>
<%else%>
<%=k%>
<%end if%>
<%next%>
<%if nowpage < pages then%>
<a href="index.asp?act=last20&page=<%=nowpage+1%>">下一页</a>
<%else%>
下一页
<%end if%>
<%if nowpage>1 then%>
<a href="index.asp?act=last20&page=<%=1%>"> 首页</a>
<%else%>
首页
<%end if%>
<%if nowpage<pages then %>
<a href="index.asp?act=last20&page=<%=pages%>">末页</a>
<%else%>
末页
<%end if%>
 </span>
	<%End Sub
  
	
	%>
</p>
<%
Function Fn_MaxDay(Mon)
	Mon = cstr(Mon)
	Select Case Mon
		Case "1","3","5","7","8","10","12"
					Fn_MaxDay = 31
		Case "4","6","9","11"
					Fn_Maxday = 30
		Case "2"
			if year(Now()) mod 4 = 0 then
					Fn_Maxday = 29
			else
					Fn_Maxday = 28
			end if 	
	end Select

End Function%>
<% Sub DrawTable(title,str) %>
<table width="725" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#E1ECF2"><%=title%></td>
  </tr>
  <tr>
    <td><img src="images/body_line.gif" width="725" height="3"></td>
  </tr>
  <tr>
    <td class="body_bg"><table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center" valign="middle" background="images/body_bg2.gif">
		<br>
	<%=str%>
		<br>
        <br>
		<br></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src="images/body_line.gif" width="725" height="3"></td>
  </tr>
  <tr bgcolor="#E7E7E7">
    <td height="3px"></td>
  </tr>
</table>
<% end Sub %>
<div id="idiv"></div>
<br>
<table width="760" height="31" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="3" align="center" bgcolor="#E1ECF2"><table align=center  style="color:#FFFFFF ">
<tr align=center>
<td  width="100%" class=copyright>
专业的B2B行业网站系统，行业门户网站的首选系统·中国, Copyright (c) All Rights Reserved 
</td>
</tr></table>
</td>
  </tr>
</table>
</body>
</html>
