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

<form name="form6" method="post" action="?Action=lydel">
<table class="tb_1">
<tr>
<td colspan="7" > 
<select  name="adddate" id="adddate" size="1" onChange="window.location='?Action=<%=Action%>&AddDate='+document.getElementById('adddate').options[document.getElementById('adddate').selectedIndex].value">
<option value="">请选择日期</option>
                    <%Sql="Select AddDate From CFCount_Ly_Day Group By AddDate Order By AddDate Desc"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open Sql,Conn,1,1
While Not Rs.Eof 
 Response.Write "<option value='"&Rs("AddDate")&"'"
 If Request("AddDate")=Cstr(Rs("AddDate")) Then Response.Write " selected"
 Response.Write ">"&Rs("AddDate")&"</option>"  
Rs.MoveNext
Wend  
%>
</select></td>
</tr>
<%
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Then
 Ip = ChkStr(Request.ServerVariables("REMOTE_ADDR"),1)
Else
 Ip = ChkStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),1)
 If InStr(Ip, ",") > 0 Then Ip = ChkStr(Left(Ip, InStr(Ip, ",") - 1),1)
End If

Px=ChkStr(Request("Px"),1)
AddDate=ChkStr(Request("AddDate"),3)

If Px="" Then  Px="MyCounter"
If AddDate="" Then AddDate=Cstr(Date)

PageUrl = "?Action="&Action&"&AddDate="&AddDate

Call PxFilter(Px,"id,ip,lyhead,addtime,MyCounter,lasttime")

If AddDate<>"" Then
 If IsDate(Cdate(AddDate))=False Then Call AlertBack("输入了错误的时间",1)
End if

Sql="Select Sum(MyCounter) From CFCount_Ly_Day where Datediff('d',AddDate,'"&AddDate&"')=0"
Set Rs=Conn.execute(Sql)
ThisDayTotal=Rs(0)
If ThisDayTotal=0 Then ThisDayTotal=1

Sql="Select * From CFCount_Ly_Day where Datediff('d',AddDate,'"&AddDate&"')=0"

Sql=Sql&" Order By "&Px&" Desc"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open Sql,Conn,1,1

If Not Rs.eof then
 Rs.pagesize=20
 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
%>
<tr class="tr_1"> 
<td colspan="7"><%=AddDate%> 来源统计[可点击标题排序]</td>
</tr>
<tr class="tr_2"> 
<td><a href="<%=PageUrl%>&Px=ID">序号</a></td>
<td><a href="<%=PageUrl%>&Px=LyHead">来源网站</a></td>
<td><a href="<%=PageUrl%>&Px=MyCounter">来源数量</a></td>
<td><a href="<%=PageUrl%>&Px=MyCounter">所占此天的比例</a></td>
<td><a href="<%=PageUrl%>&Px=AddTime">上站时间</a></td>
<td><a href="<%=PageUrl%>&Px=Ip">最后IP地址</a></td>
<td><a href="<%=PageUrl%>&Px=LastTime">最后访问时间</a></td>
</tr>
<%
While Not Rs.Eof And MyPageSize>0
%>
<tr class="tr_2"> 
<td><%=Rs.RecordCount-Rs.Pagesize*(page)+mypagesize%></td>
<td> 
<%If Rs("LyHead")="" Then
  Response.Write "直接从浏览器输入"
 Else
  Response.Write "<a href=http://"&Rs("LyHead")&" target='_blank'>"&Rs("LyHead")&"</a>&nbsp;[<a href="&Rs("Ly")&" target='_blank'>详细</a>]"
 End If%>
</td>
<td><%=Rs("MyCounter")%></td>
<td style="text-align:left;"><img src=images/bar_blue.gif width=<%=Rs("MyCounter")/ThisDayTotal*150%> height=10><%=MyRate(Rs("MyCounter"),ThisDayTotal)%>%</td>
<td><%=GetTurnTime(Hour(Rs("AddTime")))&":"&GetTurnTime(Minute(Rs("AddTime")))&":"&GetTurnTime(Second(Rs("AddTime")))%></td>
<td> 
	<%If Ip=Rs("Ip") Then Response.Write "<font color=ff0000>"%>
	<%=Rs("Ip")%> 
	<%If Ip=Rs("Ip") Then Response.Write "</font>"%>
</td>
<td><%=GetTurnTime(Hour(Rs("LastTime")))&":"&GetTurnTime(Minute(Rs("LastTime")))&":"&GetTurnTime(Second(Rs("LastTime")))%></td>
</tr>
<%rs.movenext
mypagesize=mypagesize-1
wend%>            
</table>
</form>
<%
Response.write GetPageList(TotalRs,TotalPage,Page,PageUrl,Px)
%>
