<%
'乘风多用户计数器
'作者QQ：178575
'作者EMail：yliangcf@163.com
'作者网站：http://www.qqcf.com
'详细简介：http://www.qqcf.com/cfcount.htm
'上面有程序在线演示，安装演示，使用疑难解答，最新版本下载等内容
'因为这些内容可能时常更新，没有放在程序里，请自己上网站上查看
%>
<%If SysCode="" Then Response.End%>


<table class="tb_1">
<tr class="tr_1">
<td>
<%
Sql="Select Sum(MyCounter),Sum(IpCounter),Count(ID) From CFCount_Count_Day Where UserName='"&UserName&"'"
Set Rs=Conn.ExeCute(Sql)

If TotalRs=0 Then
 AvgVisit=0
 AvgIp=0
Else
 AvgVisit=Int(Rs(0)/TotalRs)
 AvgIp=Int(Rs(1)/TotalRs)
End If

ShowTotal=Rs(0)
IpTotal=Rs(1)
If ShowTotal=0 Then ShowTotal=1
If IpTotal=0 Then IpTotal=1
%>

共有<%=Rs(2)%>天记录，共<%=Rs(0)%>次浏览，<%=Rs(1)%>个IP，平均每天<%=AvgVisit%>次访问，平均每天IP<%=AvgIp%>个</td>
</tr>

</table> 
<table class="tb_1">
<%
Sql="Select Top 1 IpCounter,AddDate From CFCount_Count_Day Where UserName='"&UserName&"' Order By IpCounter Desc"
Set Rs1=Conn.ExeCute(Sql)
If Not Rs1.Eof Then
 BestHightIp=Rs1("IpCounter")
 BestHightIpDate=Rs1("AddDate")
Else
 BestHightIp=0
 BestHightIpDate=""
End If
Rs1.Close

Sql="Select Top 1 IpCounter,AddDate From CFCount_Count_Day Where UserName='"&UserName&"' Order By IpCounter"
Set Rs1=Conn.ExeCute(Sql)
If Not Rs1.Eof Then
 BestLowIp=Rs1("IpCounter")
 BestLowIpDate=Rs1("AddDate")
Else
 BestLowIp=0
 BestLowIpDate=""
End If
Rs1.Close

Sql="Select Top 1 MyCounter,AddDate From CFCount_Count_Day Where UserName='"&UserName&"' And DateDiff('d',AddDate,Date())>0 Order By MyCounter Desc"
Set Rs1=Conn.ExeCute(Sql)
If Not Rs1.Eof Then
 BestHightVisit=Rs1("MyCounter")
 BestHightVisitDate=Rs1("AddDate")
Else
 BestHightVisit=0
 BestHightVisitDate=""
End If
Rs1.Close

Sql="Select Top 1 MyCounter,AddDate From CFCount_Count_Day Where UserName='"&UserName&"' And DateDiff('d',AddDate,Date())>0 Order By MyCounter"
Set Rs1=Conn.ExeCute(Sql)
If Not Rs1.Eof Then
 BestLowVisit=Rs1("MyCounter")
 BestLowVisitDate=Rs1("AddDate")
Else
 BestLowVisit=0
 BestLowVisitDate=""
End If
Rs1.Close
%><tr class="tr_1">
<td colspan="4">日访问统计[可点击标题排序] 
<%
Px=ChkStr(request("Px"),1)
If Px="" Then Px="ID"

PageUrl = "?Action="&Action

Call PxFilter(Px,"id,MyCounter,ipcounter,adddate")

Sql="Select * From CFCount_Count_Day Where UserName='"&UserName&"' Order By "&Px&" Desc"

Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open Sql,Conn,1,1
If Not Rs.Eof Then
rs.pagesize=10
totalrs=rs.RecordCount
totalpage=rs.pageCount
mypagesize=rs.pagesize
Page=CLng(ChkStr(Request("Page"),2))
If Page<=0 Then Page=1
If Page>TotalPage Then Page=TotalPage
rs.absolutepage=page
End If
%>
<br>
</td>
</tr>
<tr class="tr_2"> 
<td><a href="<%=PageUrl%>&Px=AddDate">日期</a></td>
<td><a href="<%=PageUrl%>&Px=MyCounter">显示数量</a></td>
<td><a href="<%=PageUrl%>&Px=IpCounter">IP数量</a></td>
<td><a href="<%=PageUrl%>&Px=MyCounter">在十天内的比率</a></td>
</tr>
<%While Not Rs.Eof And MyPageSize>0%>

<tr class="tr_2"> 
<td><%=Rs("AddDate")%></td>
<td><%=Rs("MyCounter")%><br>
</td>
<td><%=Rs("IpCounter")%></td>
<td style="text-align:left;"><img src=images/bar_blue.gif width=<%=Rs("MyCounter")/ShowTotal*300%> height=10><%=MyRate(Rs("MyCounter"),ShowTotal)%>%<br>
<img src=images/bar_green.gif width=<%=Rs("IpCounter")/IpTotal*300%> height=10><%=MyRate(Rs("IpCounter"),IpTotal)%>%</td>
</tr>
<%Rs.MoveNext
MyPageSize=MyPageSize-1
Wend%>
<tr> 
<td colspan="4" >图例： <img src=images/bar_blue.gif width=30 height=10>显示数，<img src=images/bar_green.gif width=30 height=10>IP数</td>
</tr>
<tr> 
<td colspan="4"> <%
Sql="Select Sum(MyCounter),Sum(IpCounter) From CFCount_Count_Day Where UserName='"&UserName&"'"
Set Rs1=Conn.ExeCute(Sql)

If TotalRs=0 Then
AvgVisit=0
AvgIp=0
Else
AvgVisit=Int(Rs1(0)/TotalRs)
AvgIp=Int(Rs1(1)/TotalRs)
End If
%>
共有<%=TotalRs%>天记录，共<%=Rs1(0)%>次浏览，<%=Rs1(1)%>个IP，平均每天<%=AvgVisit%>次访问，平均每天IP<%=AvgIp%>个</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
</table>

<%
Rs.Close
Rs1.Close

Response.write GetPageList(TotalRs,TotalPage,Page,PageUrl,Px)
%>
