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

If AddYear="" Then AddYear=Year(Now)
%>

<form name="form2" method="post" action="?Action=<%=Action%>" onSubmit="return yearcheck2();">
<table class="tb_1"><tr>
    <td>选择查询年份
<Select  name="addyear" size="1">
<option>请选择年份</option>
<%Sql="Select AddYear From CFCount_Alexa_Week Where UserName='"&UserName&"' Group By AddYear Order By AddYear Desc"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open Sql,Conn,1,1

While Not Rs.Eof 
 Response.Write "<option value='"&Rs("AddYear")&"'"
 If Cstr(AddYear)=Cstr(Rs("AddYear")) Then Response.Write " selected"
 Response.Write ">"&Rs("AddYear")&"年</option>"  
Rs.MoveNext
Wend  
%>
        </select>
        <input type="submit" name="Submit3" value="查询">
      </td>
  </tr>
</table></form>
  
<table class="tb_1">
        <%
IpTotal=0
Session("CFCountTemp")=""
Sql="Select Sum(IpCounter) From CFCount_Alexa_Week where UserName='"&UserName&"' And AddYear="&AddYear
Set Rs=Conn.Execute(Sql)
IpTotal=Rs(0)

Sql="Select IpCounter,AddWeek From CFCount_Alexa_Week where UserName='"&UserName&"' And AddYear="&AddYear
Set Rs=Conn.Execute(Sql)

If Not Rs.eof Then
  Session("CFCountTemp")=Rs.GetRows(-1)
End If

H=52
H_2=H
If Cstr(AddYear)=Cstr(Year(Now)) Then H_2=datepart("ww",now)
%>
<tr class="tr_1">
          <td colspan="3"><%=AddYear%>年 Alexa周报表</td>
        </tr>
        <tr class="tr_2"> 
          <td>&nbsp;</td>
          <td colspan="2">Alexa个数</td>
        </tr>
        <tr class="tr_2"> 
          <td>&nbsp;</td>
          <td colspan="2">共&nbsp;<%=IpTotal%>&nbsp;个,平均每周&nbsp;<%=Int(IpTotal/H_2)%>&nbsp;个</td>
        </tr>
        <tr class="tr_2"> 
          <td>周数</td>
          <td colspan="2">IP数量</td>
        </tr>
        <%

For I=1 To 52
ShowNum=0
IpNum=0
J=0
For J=0 To Ubound(Session("CFCountTemp"),2)
 If Session("CFCountTemp")(1,J)=I Then
  IpNum=Session("CFCountTemp")(0,J)
 End If
Next
%>
        <tr class="tr_2"> 
          <td>第&nbsp;<%=I%>&nbsp;周</td>
          <td><%=IpNum%></td>
          <td  class="td_1"><img src=images/bar_green.gif width=<%=CInt(IpNum/IpTotal*120)%> height=10><%=MyRate(IpNum,IpTotal)%>%</td>
        </tr>
        <%
Next%>
      </table>
