<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp"-->
<!--#include file="showpage.asp"-->
<%If Not FRAdminLevel(704) Then Call ErrorMsg()
Response.Expires = 0 
Response.CacheControl = "no-cache" 
Response.ExpiresAbsolute = Now() - 1 
Dim Action
%>
<html>
<head>
<title>访问统计管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script>
<style type="text/css">
<!--
.STYLE2 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <tr>
    <th height="25">访问统计管理</th>
  </tr>
  <tr>
    <td height=25 style="border-bottom:1px #cccccc solid"><b>　<span class="style1">管理选项：</span></b><a href="admin_CountIndex.asp">统计情况</a> | <a href="admin_CountIndex.asp?Action=all">详细记录</a> | <a href="admin_CountIndex.asp?Action=chour">24小时统计</a> | <a href="admin_CountIndex.asp?Action=cday">日统计</a> | <a href="admin_CountIndex.asp?Action=cweek">周统计</a> | <a href="admin_CountIndex.asp?Action=cmonth">月统计</a> | <a href="admin_CountIndex.asp?Action=ccome">来源统计</a> | <a href="admin_CountIndex.asp?Action=cpage">访问页面</a> | <a href="admin_CountIndex.asp?Action=cip">区域统计</a> |<!--<a href="admin_CountIndex.asp?Action=cbrower">客户端软件</a>| --><!--<a href="admin_CountIndex.asp?Action=caction">自定义</a> |--> <a href="#" onClick="if (confirm('您确定要清除所有统计记录吗？\n注意：此操作不可恢复！')) window.location='admin_CountIndex.asp?Action=del'">清除统计</a> |&nbsp;[<a href="javascript:location.reload()">刷新页面</a>]</td>
  </tr>
</table>
<%
'统计数据
set totalrs=conn.execute("select count(*) as total from JOB_Count")
total=totalrs("total")
totalrs.close
set totaliprs=conn.execute("select count(*) as total from JOB_Count where C_id in (select min(C_id) from JOB_Count group by C_ip)")   
totalip=totaliprs("total")
totaliprs.close
sql="select top 1 c_time from JOB_Count order by C_time asc"
set totalrs=Server.CreateObject("ADODB.RecordSet")
totalrs.open sql,conn,1,1
if totalrs.eof then
firsttime=now()
else
firsttime=totalrs("c_time")
end if
if isnull(total) then total=0
if isnull(totalip) then totalip=0
if isnull(firsttime) then firsttime=now()

if total=0 then
	conn.close
	set conn=nothing
	response.Write "<br><br><center>还没有开始统计数据!</center>"
	response.End()
end if
'查今日访问量，昨日访问量
set todayrs=conn.execute("select N_today,N_yesterday from JOB_Countnum")
ctoday=todayrs("N_today")
cyesterday=todayrs("N_yesterday")
if isnull(ctoday) then ctoday=0
if isnull(cyesterday) then cyesterday=0

'查今日访问量
set rs=conn.execute("select count(*) as cthisday from JOB_Count where C_year="&year(now())&" and c_month="&month(now())&" and c_day="&day(now())&"")
cthisday=rs("cthisday")
if isnull(cthisday) then cthisday=0
set rs=conn.execute("select count(*) as cthisdayip from JOB_Count where C_id in (select min(C_id) from JOB_Count where C_year="&year(now())&" and c_month="&month(now())&" and c_day="&day(now())&" group by C_ip)")
cthisdayip=rs("cthisdayip")
if isnull(cthisdayip) then cthisdayip=0

'查昨日访问量
set rs=conn.execute("select count(*) as cthisdays from JOB_Count where C_year="&year(now()-1)&" and c_month="&month(now()-1)&" and c_day="&day(now()-1)&"")
cthisdays=rs("cthisdays")
if isnull(cthisdays) then cthisdays=0
set rs=conn.execute("select count(*) as cthisdaysip from JOB_Count where C_id in (select min(C_id) from JOB_Count where C_year="&year(now()-1)&" and c_month="&month(now()-1)&" and c_day="&day(now()-1)&" group by C_ip)")
cthisdaysip=rs("cthisdaysip")
if isnull(cthisdaysip) then cthisdaysip=0
'今年访问量
set rs=conn.execute("select count(*) as cthisyear from JOB_Count where C_year="&year(now()))
cthisyear=rs("cthisyear")
if isnull(cthisyear) then cthisyear=0
set rs=conn.execute("select count(*) as cthisyearip from JOB_Count where C_id in (select min(C_id) from JOB_Count where C_year="&year(now())&" group by C_ip)")
cthisyearip=rs("cthisyearip")
if isnull(cthisyearip) then cthisyearip=0
'本月访问量
set rs=conn.execute("select count(*) as cthismonth from JOB_Count where C_year="&year(now())&" and c_month="&month(now()))
cthismonth=rs("cthismonth")
if isnull(cthismonth) then cthismonth=0
set rs=conn.execute("select count(*) as cthismonthip from JOB_Count where C_id in (select min(C_id) from JOB_Count where C_year="&year(now())&" and c_month="&month(now())&" group by C_ip)")
cthismonthip=rs("cthismonthip")
if isnull(cthismonthip) then cthismonthip=0

'访问天数，平均访问量
dd=Datediff("d",firsttime,now())
if dd<1 then
	dd=1
end if
cdayavg=total/dd
rs.close
Action=trim(Request("Action"))
set rs1=Server.CreateObject("ADODB.RecordSet")
 sql1="select * from JOB_Count order by C_time desc"
 rs1.open sql1,conn,1,1
 const linkURL="Admin_CountIndex.asp?action=all"
 const maxperpage=16
if not(rs1.bof and rs1.eof) then  '判别数据表中的记录是否为空
   dim recordtotal  '总记录条数
   dim pagetotal  '总的页数
   dim pageshow,i   '页面显示的为第几页
   RecordTotal=rs1.recordcount '总的记录条数
   rs1.pagesize=maxperpage   '每页显示的最多条数
   pagetotal=rs1.pagecount  '总的页数
   pageshow=request("pageshow")	   
	if pageshow<>"" and IsNumeric(pageshow) then
		if pageshow<1 Or Len(pageshow)>10 Then
			pageshow=1
		elseif Clng(pageshow)>pagetotal then
			pageshow=pagetotal
		else
			pageshow=CLng(pageshow)
		end If
	else
		pageshow=1
	end If
end if
Select Case Action
	Case "all"
		Call all()
	Case "cday"
		Call cday()
	Case "cweek"
		Call cweek()
	Case "cmonth"
		Call cmonth()
	Case "ccome"
		Call ccome()
	Case "cpage"
		Call cpage()
	Case "cip"
		Call cip()
	Case "cbrower"
		Call cbrower()
	Case "caction"
		Call caction()
	Case "del"
		Call del()
	Case "chour"
		Call chour()
	Case Else
		Call main()
End Select

if FoundErr=True then
	call Show_Err()
end if

Conn.Close
Set Conn=Nothing
%>
<!--#include file="../inc/copy.asp" -->
<%Sub Main()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6" style="margin-bottom:2px;">
<tr>
  <th colspan="8">访问数据统计</th>
</tr>
<tr align=center>
<td width="13%">总访问量</td>
<td width="39%" height="25"><%=totalip%>/<%=total%></td>
<td width="13%">开始统计时间</td>
<td width="35%"><%=firsttime%></td>
</tr>
<tr align=center>
  <td>今日访问量</td>
  <td height="25"><%=cthisdayip%>/<%=cthisday%></td>
  <td>昨日访问量</td>
  <td><%=cthisdaysip%>/<%=cthisdays%></td>
  </tr>
<tr align=center>
  <td>本月访问量</td>
  <td height="25"><%=cthismonthip%>/<%=cthismonth%></td>
  <td>今年访问量</td>
  <td><%=cthisyearip%>/<%=cthisyear%></td>
  </tr>
<tr align=center>
  <td>总统计时间</td>
  <td height="25"><%=dd%></td>
  <td>平均访问量</td>
  <td><%=FormatNumber(cdayavg,2)%></td>
  </tr>
</table>
<%end sub%>
<%Sub all()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="10">访问详细记录</th>
</tr>
<tr align=center>
  <td width="5%"><strong>编号</strong></td>
  <td width="37%"><strong>来源网页</strong></td>
  <td width="17%"><strong>访问时间</strong></td>
  <td width="13%" height="25"><strong>访问IP</strong></td>
  <td width="17%"><strong>使用浏览器</strong></td>
  <td width="11%"><strong>使用操作系统</strong></td>
  
  </tr>
<%  
		if not(Rs1.bof and Rs1.eof) then
	      Rs1.move(Cint(pageshow)-1)*maxperpage,1
	    for i=1 to Rs1.pagesize
%>
<tr align=center>
  <td><%=i%></td>
  <td height="25" align="left">&nbsp;<%if rs1("C_come")="网址输入或收藏夹打开" then%><%=rs1("C_come")%><%else%><a href="<%=rs1("C_come")%>" title="查看来源网页" target="_blank"><%=rs1("C_come")%></a><%end if%></td>
  <td><%=rs1("C_time")%></td>
  <td height="25"><%=rs1("C_ip")%></td>
  <td height="25"><%=rs1("C_brower")%></td>
  <td height="25"><%=rs1("C_os")%></td>
  
  </tr>
  <%		 
	       Rs1.movenext
	       if Rs1.eof then exit for
	          next
	       end if
		   rs1.close
		   set rs1=nothing
  %>
  <input type="hidden" name="pageshow" value="<%=pageshow%>">
   	<tr>
		  <td height="22" colspan="13" align="center" bgcolor="#FFFFFF" >
  	  <%
			Call showpages(linkURL,RecordTotal,MaxPerPage,true,true,"条记录")
	%></td>
  </tr>
</table>
<%
end Sub%>
<%Sub chour()%>
<%
	'统计今日24小时中每个小时的访问数量
	dim sumcount
	sumcount=0
	dim i
	for i=0 to 23
		sumcount=sumcount+CountNum(i)
	next
	if sumcount=0 then
		sumcount=1
	end if
	
	'统计昨日网站访问情况
	dim sumcounts
	sumcounts=0
	dim j
	for j=0 to 23
		sumcounts=sumcounts+CountNums(j)
	next
	if sumcounts=0 then
		sumcounts=1
	end if
	
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="7">24小时统计</th>
</tr>
<tr align=center>
<td height="25" colspan="3">
<table width="80%" border="0" cellpadding="0" cellspacing="0" style="margin:0; padding:0; border:0; background-color:#EEF7Fd;">
  <tr>
  <% for i=0 to 23%>
    <td width="4%" align="center" valign="bottom"><img src="img/<%=i+1%>.gif" border="0" width="10" height="<%=countnum(i)*100/sumcount%>" title="访问人数共<%=countnum(i)%>人"></td>
  <% next %>
  </tr>
  <tr>
    <td align="center">00</td>
    <td align="center">01</td>
    <td align="center">02</td>
    <td align="center">03</td>
    <td align="center">04</td>
    <td align="center">05</td>
    <td align="center">06</td>
    <td align="center">07</td>
    <td align="center">08</td>
    <td align="center">09</td>
    <td align="center">10</td>
    <td align="center">11</td>
    <td align="center">12</td>
    <td align="center">13</td>
    <td align="center">14</td>
    <td align="center">15</td>
    <td align="center">16</td>
    <td align="center">17</td>
    <td align="center">18</td>
    <td align="center">19</td>
    <td align="center">20</td>
    <td align="center">21</td>
    <td align="center">22</td>
    <td align="center">23</td>
    </tr>
</table></td>
</tr>
<tr align=center>
  <td height="24" colspan="3">最近24小时网站访问数据</td>
</tr>


<tr align=center>
<td height="25" colspan="3"><table width="80%" border="0" cellpadding="2" cellspacing="1" style="margin:0; padding:0; border:0; background-color:#EEF7Fd;">
  <tr>
  <% for j=0 to 23%>
    <td width="4%" align="center" valign="bottom"><img src="img/<%=j%>.gif" border="0" width="10" height="<%=countnums(j)*100/sumcounts%>" title="访问人数共<%=countnums(j)%>人"></td>
  <% next %>
  </tr>
  <tr>
    <td align="center">00</td>
    <td align="center">01</td>
    <td align="center">02</td>
    <td align="center">03</td>
    <td align="center">04</td>
    <td align="center">05</td>
    <td align="center">06</td>
    <td align="center">07</td>
    <td align="center">08</td>
    <td align="center">09</td>
    <td align="center">10</td>
    <td align="center">11</td>
    <td align="center">12</td>
    <td align="center">13</td>
    <td align="center">14</td>
    <td align="center">15</td>
    <td align="center">16</td>
    <td align="center">17</td>
    <td align="center">18</td>
    <td align="center">19</td>
    <td align="center">20</td>
    <td align="center">21</td>
    <td align="center">22</td>
    <td align="center">23</td>
    </tr>
</table></td>
</tr>

<tr align=center>
  <td height="25" colspan="3">所有24小时网站访问数据</td>
</tr>
<!--<tr align=center>
  <td width="24%">访问时间</td>
  <td width="28%" height="25">访问数量</td>
  <td width="48%">所占比例</td>
  </tr>
<%' for i=0 to 23 %>
<tr align=center>
  <td><%'=i%>:00-<%'=i+1%>:00</td>
  <td height="25"><%'=countnum(i)%></td>
  <td><%'=FormatNumber((countnum(i)/sumcount)*100,2)%> %</td>
  </tr>
 <%'next%>
<tr align=center>
  <td>&nbsp;</td>
  <td height="25">&nbsp;</td>
  <td>&nbsp;</td>
  </tr>-->
</table>
<%end Sub%>
<%Sub cday()%>
<%
	'统计今日24小时中每个小时的访问数量
	dim daysumcount
	daysumcount=0
	dim i
	for i=1 to 31
		daysumcount=daysumcount+dayNum(i)
	next
	if daysumcount=0 then
		daysumcount=1
	end if
	
	'统计昨日网站访问情况
	'统计今日24小时中每个小时的访问数量
	dim daysumcounts
	daysumcounts=0
	dim j
	for j=1 to 31
		daysumcounts=daysumcounts+dayNums(j)
	next
	if daysumcounts=0 then
		daysumcounts=1
	end if
	
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="24">日统计</th>
</tr>
<tr align=center>
<td height="25" colspan="3"><table width="80%" border="0" cellpadding="0" cellspacing="0" style="margin:0; padding:0; border:0; background-color:#EEF7Fd;">
  <tr>
  <% for i=1 to 31%>
    <td width="4%" align="center" valign="bottom"><img src="img/<%=i+1%>.gif" border="0" width="10" height="<%=daynum(i)*100/daysumcount%>" title="访问人数共<%=daynum(i)%>人"></td>
  <% next %>
  </tr>
  <tr>
    <td align="center">01</td>
    <td align="center">02</td>
    <td align="center">03</td>
    <td align="center">04</td>
    <td align="center">05</td>
    <td align="center">06</td>
    <td align="center">07</td>
    <td align="center">08</td>
    <td align="center">09</td>
    <td align="center">10</td>
    <td align="center">11</td>
    <td align="center">12</td>
    <td align="center">13</td>
    <td align="center">14</td>
    <td align="center">15</td>
    <td align="center">16</td>
    <td align="center">17</td>
    <td align="center">18</td>
    <td align="center">19</td>
    <td align="center">20</td>
    <td align="center">21</td>
    <td align="center">22</td>
    <td align="center">23</td>
	<td align="center">24</td>
    <td align="center">25</td>
    <td align="center">26</td>
	<td align="center">27</td>
    <td align="center">28</td>
    <td align="center">29</td>
	<td align="center">30</td>
	<td align="center">31</td>
    </tr>
</table></td>
</tr></td>
</tr>
<tr align=center>
<td height="25" colspan="3">最近一个月的日访问统计数据</td>
</tr>
<tr align=center>
<td height="25" colspan="3"><table width="80%" border="0" cellpadding="0" cellspacing="0" style="margin:0; padding:0; border:0; background-color:#EEF7Fd;">
  <tr>
  <% for j=1 to 31%>
    <td width="4%" align="center" valign="bottom"><img src="img/<%=j+1%>.gif" border="0" width="10" height="<%=daynums(j)*100/daysumcounts%>" title="访问人数共<%=daynums(j)%>人"></td>
  <% next %>
  </tr>
  <tr>
    <td align="center">01</td>
    <td align="center">02</td>
    <td align="center">03</td>
    <td align="center">04</td>
    <td align="center">05</td>
    <td align="center">06</td>
    <td align="center">07</td>
    <td align="center">08</td>
    <td align="center">09</td>
    <td align="center">10</td>
    <td align="center">11</td>
    <td align="center">12</td>
    <td align="center">13</td>
    <td align="center">14</td>
    <td align="center">15</td>
    <td align="center">16</td>
    <td align="center">17</td>
    <td align="center">18</td>
    <td align="center">19</td>
    <td align="center">20</td>
    <td align="center">21</td>
    <td align="center">22</td>
    <td align="center">23</td>
	<td align="center">24</td>
    <td align="center">25</td>
    <td align="center">26</td>
	<td align="center">27</td>
    <td align="center">28</td>
    <td align="center">29</td>
	<td align="center">30</td>
	<td align="center">31</td>
    </tr>
</table></td>
</tr>
<tr align=center>
  <td height="25" colspan="3">所有月份的日访问统计数据</td>
</tr>
</table>
<%end Sub%>
<%Sub cweek()%>
<%
	dim weeksumcounts
	weeksumcounts=0
	dim i
	for i=0 to 23
		weeksumcounts=weeksumcounts+weekNums(i)
	next
	if weeksumcounsts=0 then
		weeksumcounts=1
	end if
	
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="8">周统计</th>
</tr>
<tr align=center>
<td height="25" colspan="8"><table width="40%" border="0" cellpadding="0" cellspacing="0" style="margin:0; padding:0; border:0; background-color:#EEF7Fd;">
  <tr>
  <% for i=1 to 7%>
    <td width="4%" align="center" valign="bottom"><img src="img/<%=i+1%>.gif" border="0" width="10" height="<%=weeknums(i)/weeksumcounts%>" title="访问人数共<%=weeknums(i)%>人"></td>
  <% next %>
  </tr>
  <tr>
    <td align="center">周日</td>
    <td align="center">周一</td>
    <td align="center">周二</td>
    <td align="center">周三</td>
    <td align="center">周四</td>
    <td align="center">周五</td>
    <td align="center">周六</td>
    </tr>
</table></td>
</tr>
</table>
<%end Sub%>
<%Sub cmonth()%>
<%
	dim monthsumcount
	monthsumcount=0
	dim i
	for i=1 to 12
		monthsumcount=monthsumcount+monthNum(i)
	next
	if monthsumcount=0 then
		monthsumcount=1
	end if
	
	dim monthsumcounts
	monthsumcounts=0
	dim j
	for j=1 to 12
		monthsumcounts=monthsumcounts+monthNums(i)
	next
	if monthsumcounts=0 then
		monthsumcounts=1
	end if
	
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="8">月统计</th>
</tr>
<tr align=center>
<td height="25" colspan="8"><table width="90%" border="0" cellpadding="0" cellspacing="0" style="margin:0; padding:0; border:0; background-color:#EEF7Fd;">
  <tr>
  <% for i=1 to 12%>
    <td width="5%" align="center" valign="bottom"><img src="img/<%=i+1%>.gif" border="0" width="10" height="<%=monthnum(i)*10/monthsumcount%>" title="访问人数共<%=monthnum(i)%>人"></td>
  <% next %>
  </tr>
  <tr>
    <td align="center">一月份</td>
    <td align="center">二月份</td>
    <td align="center">三月份</td>
    <td align="center">四月份</td>
    <td align="center">五月份</td>
    <td align="center">六月份</td>
    <td align="center">七月份</td>
	<td align="center">八月份</td>
    <td align="center">九月份</td>
    <td align="center">十月份</td>
    <td align="center">十一月份</td>
    <td align="center">十二月份</td>
    </tr>
</table></td>
</tr>
<tr>
  <th colspan="8" align="center">最近一年的所有月份数据统计</th>
</tr>
<tr align=center>
<td height="25" colspan="8"><table width="90%" border="0" cellpadding="0" cellspacing="0" style="margin:0; padding:0; border:0; background-color:#EEF7Fd;">
  <tr>
  <% for j=1 to 12%>
    <td width="5%" align="center" valign="bottom"><img src="img/<%=j%>.gif" border="0" width="10" height="<%=(monthnums(j)/10)/monthsumcounts%>" title="访问人数共<%=monthnums(j)%>人"></td>
  <% next %>
  </tr>
  <tr>
    <td align="center">一月份</td>
    <td align="center">二月份</td>
    <td align="center">三月份</td>
    <td align="center">四月份</td>
    <td align="center">五月份</td>
    <td align="center">六月份</td>
    <td align="center">七月份</td>
	<td align="center">八月份</td>
    <td align="center">九月份</td>
    <td align="center">十月份</td>
    <td align="center">十一月份</td>
    <td align="center">十二月份</td>
    </tr>
</table></td>
</tr>
<tr>
  <th colspan="8" align="center">所以年份的所有月份数据统计</th>
</tr>
</table>
<%end Sub%>
<%Sub ccome()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="7">来源统计</th>
</tr>
<tr align=center>
<td width="46%">来源页面</td>
<td height="25" colspan="2">所占比例</td>
</tr>
<%
	sql="select C_come,count(*) as countnum from JOB_Count group by C_come"
	set rs=Server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,1
	sumnum=0
	if not (rs.bof and rs.eof) then
		for i=1 to rs.recordcount
			sumnum=sumnum+rs("countnum")
		rs.movenext
		next
	else
		sumnum=1
	end if
	rs.close
	set rs1=Server.CreateObject("ADODB.RecordSet")
	rs1.open sql,conn,1,1
	if not (rs1.bof and rs1.eof) then
	do while not rs1.eof
%>
<tr align=center>
  <td align="left">&nbsp;<% if rs1("C_come")="网址输入或收藏夹打开" then%><%=rs1("C_come")%><%else%> <a href="<%=rs1("C_come")%>" title="访问该页面"><%=rs1("C_come")%></a><%end if%></td>
  <td width="39%" height="25" align="left" valign="middle"><hr style="height:10; width:<%=clng(rs1("countnum")*300/sumnum)%>; color:#0000FF;"></td>
  <td width="15%" align="left">共<span class="STYLE2"><%=rs1("countnum")%></span>人(<%=FormatNumber((rs1("countnum")/sumnum)*100,2)%>%)</td>
</tr>
<%
	rs1.movenext
	loop
	rs1.close
	end if
%>
</table>
<%end Sub%>
<%Sub cpage()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="7">访问页面统计</th>
</tr>
<tr align=center>
<td width="45%">访问页面</td>
<td width="38%" height="25">访问总数</td>
<td>所占比例</td>
</tr>
<%
	sql="select C_page,count(*) as countnum from JOB_Count group by C_page"
	set rs=Server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,1
	sumnum=0
	if not (rs.bof and rs.eof) then
		for i=1 to rs.recordcount
			sumnum=sumnum+rs("countnum")
		rs.movenext
		next
	else
		sumnum=1
	end if
	rs.close
	set rs=nothing
	set rs1=Server.CreateObject("ADODB.RecordSet")
	rs1.open sql,conn,1,1
	if not (rs1.bof and rs1.eof) then
	do while not rs1.eof
%>
<tr align=center>
  <td align="left">&nbsp; <a href="<%=rs1("C_page")%>" title="访问该页面"><%=rs1("C_page")%></a></td>
  <td width="38%" height="25" align="left" valign="middle"><hr style="height:10; width:<%=clng(rs1("countnum")*300/sumnum)%>; color:#0000FF;"></td>
  <td width="17%" align="left">共<span class="STYLE2"><%=rs1("countnum")%></span>人(<%=FormatNumber((rs1("countnum")/sumnum)*100,2)%>%)</td>
</tr>
<%
	rs1.movenext
	loop
	rs1.close
	set rs1=nothing
	end if
%>
</table>
<%end Sub%>
<%Sub cip()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="8">区域统计</th>
</tr>
<tr align=center>
<td width="20%">访问地区</td>
<td width="52%" height="25">访问总数</td>
<td width="28%" colspan="2">所占比例</td>
</tr>
<%
	sql="select C_where,count(*) as countnum from JOB_Count group by C_where"
	set rs=Server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,1
	sumnum=0
	if not (rs.bof and rs.eof) then
		for i=1 to rs.recordcount
			sumnum=sumnum+rs("countnum")
		rs.movenext
		next
	else
		sumnum=1
	end if
	rs.close
	set rs=nothing
	set rs1=Server.CreateObject("ADODB.RecordSet")
	rs1.open sql,conn,1,1
	if not (rs1.bof and rs1.eof) then
	do while not rs1.eof
%>
<tr align=center>
  <td><%=rs1("C_where")%></td>
  <td height="25" align="left"><hr style="height:10; width:<%=clng(rs1("countnum")*400/sumnum)%>; color:#0000FF;"></td>
  <td colspan="2">共<span class="STYLE2"><%=rs1("countnum")%></span>人(<%=FormatNumber((rs1("countnum")/sumnum)*100,2)%>%)</td>
</tr>
<%
	rs1.movenext
	loop
	rs1.close
	end if
%>
<tr align=center>
  <td>&nbsp;</td>
  <td height="25">&nbsp;</td>
  <td colspan="2">&nbsp;</td>
</tr>
<tr align=center>
  <td>&nbsp;</td>
  <td height="25">&nbsp;</td>
  <td colspan="2">&nbsp;</td>
</tr>
</table>
<%end Sub%>
<%Sub cbrower()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="8">客户端软件统计</th>
</tr>
<tr align=center>
<td width="28%">操作系统类型统计</td>
<td width="24%" height="25">&nbsp;</td>
<td width="48%" colspan="2">&nbsp;</td>
</tr>
<tr align=center>
  <td>浏览器类型统计</td>
  <td height="25">&nbsp;</td>
  <td colspan="2">&nbsp;</td>
  </tr>
<tr align=center>
  <td>&nbsp;</td>
  <td height="25">&nbsp;</td>
  <td colspan="2">&nbsp;</td>
  </tr>
</table>
<%end Sub%>
<%Sub caction()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder mt6">
<tr>
  <th colspan="6">自定义统计</th>
</tr>
<form name="cactionform" method="post" action="Admin_CountIndex.asp?action=caction">
<tr align=center>
<td width="11%" align="center">时间段</td>
<td width="89%" height="25" align="left"><input type="text" name="textfield">
  <input type="text" name="textfield2"></td>
</tr>
<tr align=center>
  <td>IP地址</td>
  <td height="25" align="left"><input type="text" name="textfield3"></td>
  </tr>
<tr align=center>
  <td>来自地区</td>
  <td height="25" align="left"><input type="text" name="textfield4"></td>
  </tr>
<tr align=center>
  <td>客户端</td>
  <td height="25" align="left"><select name="select">
  </select>
    <select name="select2">
    </select>
    </td>
  </tr>
<tr align=center>
  <td>来自网页</td>
  <td height="25" align="left"><input type="text" name="textfield5"></td>
  </tr>
<tr align=center>
  <td>访问页面</td>
  <td height="25" align="left"><input type="text" name="textfield6"></td>
  </tr>
<tr align=center>
  <td>输出效果</td>
  <td height="25" align="left"><input name="checkbox" type="checkbox" class="checkbox" value="checkbox">
  <input name="checkbox" type="checkbox" class="checkbox" value="checkbox">
  <input name="checkbox" type="checkbox" class="checkbox" value="checkbox">
  <input name="checkbox" type="checkbox" class="checkbox" value="checkbox">
  <input name="checkbox" type="checkbox" class="checkbox" value="checkbox">
  <input name="checkbox" type="checkbox" class="checkbox" value="checkbox">
  <input name="checkbox" type="checkbox" class="checkbox" value="checkbox">
  </td>
  </tr>
<tr align=center>
  <td height="25" colspan="2"><input name="Submit" type="submit" class="inputs" value=" 查 看 效 果 "></td>
  </tr>
</form>
</table>
<%end Sub%>
<%
Sub del()
	conn.execute("delete from JOB_Count")
	conn.execute("delete from JOB_Countnum")
end Sub%>
</body>
</html>
<%
'统计今日每个小时的访问数量
'参数：chour:统计哪一小时
Function CountNum(chour)
	sql="select count(*) from JOB_count where C_day="&day(now())&" and C_hour="&chour
	set rs=conn.execute(sql)
	if not rs.eof then
		CountNum=rs(0)
	else
		CountNum=0
	end if
	rs.close
	set rs=nothing
End Function

'统计所有每个小时的访问数量
'参数：chour:统计哪一小时
Function CountNums(chour)
	sql="select count(*) from JOB_count where C_hour="&chour
	set rs=conn.execute(sql)
	if not rs.eof then
		CountNums=rs(0)
	else
		CountNums=0
	end if
	rs.close
	set rs=nothing
End Function

	'统计所有每个小时的访问数量
'参数：cday:统计哪天
Function dayNum(cday)
	sql="select count(*) from JOB_count where C_month="&month(now())&" and C_day="&cday
	set rs=conn.execute(sql)
	if not rs.eof then
		dayNum=rs(0)
	else
		dayNum=0
	end if
	rs.close
	set rs=nothing
End Function

		'统计所有每个小时的访问数量
'参数：cday:统计哪天
Function dayNums(cday)
	sql="select count(*) from JOB_count where C_day="&cday
	set rs=conn.execute(sql)
	if not rs.eof then
		dayNums=rs(0)
	else
		dayNums=0
	end if
	rs.close
	set rs=nothing
End Function


Function weekNums(cweek)
	sql="select count(*) from JOB_count where C_week="&cweek
	set rs=conn.execute(sql)
	if not rs.eof then
		weekNums=rs(0)
	else
		weekNums=0
	end if
	rs.close
	set rs=nothing
End Function

Function monthNum(cmonth)
	sql="select count(*) from JOB_count where C_year="&year(now())&" and C_month="&cmonth
	set rs=conn.execute(sql)
	if not rs.eof then
		monthNum=rs(0)
	else
		monthNum=0
	end if
	rs.close
	set rs=nothing
End Function

Function monthNums(cmonth)
	sql="select count(*) from JOB_count where C_month="&cmonth
	set rs=conn.execute(sql)
	if not rs.eof then
		monthNums=rs(0)
	else
		monthNums=0
	end if
	rs.close
	set rs=nothing
End Function
%>