<!--#include file = "Startup.asp"-->
<!-- #include file="Function.asp" -->
<%
call adminer()
call Header()
Call ComeUrl()
Call IfUserClass()
%>
<%
DataBasePath="../MyDataBase/#Company.mdb"
%>
<%
	Dim IsSubmit : IsSubmit=request.form("IsSubmit")
	Dim Order : Order=Lcase(Request.QueryString("StringSql"))
	If IsSubmit="yes" Then
		StartDate=Lcase(Request.Form("StartDate")) :LastDate=Lcase(Request.Form("LastDate")):Session("StartDate")=StartDate:Session("LastDate")=LastDate
		ThePhone =Lcase(Request.Form("ThePhone")):Session("ThePhone")=ThePhone
	If Session("StartDate")="" Then Session("LastDate")=Date()
	If Session("LastDate")="" Then Session("LastDate")=Date()
	End If
	'以下为排列顺序
	If Order=Lcase("TimeDesc") Then 
			Order="Desc"
	ElseIf Order=Lcase("TimeAsc") Then
			Order="Asc"
	Else
			Order="Desc"
	End If
	If Request.QueryString("ToSearch")="Today" Then Session("StartDate")=Date() : Session("LastDate")=Date()
	'以下为查询语句设置。
	If Session("StartDate")<>"" And Session("LastDate")<>"" Then
		StrSql="SELECT * FROM VisitCount Where VisitDate between #"  & Session("StartDate") & "# and #"  & Session("LastDate") & "# and PhoneNumber Like '%" & Session("ThePhone") & "%' order by  VisitDateTime " & Order		
		ThisPageInfo=Session("StartDate") & "至"& Session("LastDate")  & "访问统计[手机:" & Session("ThePhone") & "]"
	ElseIf Session("StartDate")<>"" And Session("LastDate")=""  Then
		StrSql="SELECT * FROM VisitCount Where VisitDate = #"  & Session("StartDate") & "#   and PhoneNumber Like '%" & Session("ThePhone") & "%' order by VisitDateTime " & Order
		ThisPageInfo=Session("StartDate") &  "访问统计[手机:" & Session("ThePhone") & "]"
	Else
		StrSql="SELECT * FROM VisitCount  Where PhoneNumber Like '%" & Session("ThePhone") & "%'  order by VisitDateTime " & Order
		ThisPageInfo="全部访问统计[手机:" & Session("ThePhone") & "]"					
	End If
			

	'
Session("StrSql")=StrSql:StrSql=Session("StrSql")
Session("ThisPageInfo")=ThisPageInfo:ThisPageInfo=Session("ThisPageInfo")
	Set Conn=Server.Createobject("adodb.connection")
	Conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(DataBasePath)
	set rs=server.createobject("adodb.recordset")
	Rs.open StrSql,conn,1,3
	Dim iPageSize 
	Dim iPageCount 
	Dim iPageCurrent 
	Dim iRecordsShown 
	Dim I 
	iPageSize = 20 
If Request.QueryString("page") = "" Then
	iPageCurrent = 1
Else
	Session("NowPage")= CInt(Request.QueryString("page"))
	iPageCurrent =CInt(Request.QueryString("page"))
End If
	rs.PageSize = iPageSize
	rs.CacheSize = iPageSize
iPageCount = rs.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
	response.write ("对不起，无记录")
Else
	rs.AbsolutePage = iPageCurrent
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="js/common.css" type="text/css" rel="stylesheet">
<title></title>
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#DEDFDE">
  <tr bgcolor="#F7F7F7"> 
    <td colspan="7"><div align="center"> <strong> WAP访问统计系统</strong></div></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height="12" colspan="3">总计:<font color="#FF0000"><%=RS.RecordCount %></font>条;<font color="#FF0000"><%= iPageCurrent %></font>/<font color="#FF0000"><%= iPageCount %></font></td>
    <td height="12"><a href="VisitCount.asp?ToSearch=Today">今日访问</a></td>
    <td colspan="3"> <%=ThisPageInfo%> </td>
  </tr>
  <tr bgcolor="#F7F7F7"> 
    <td>序号</td>
    <td>手机号码</td>
    <td nowrap>访问时间(<a href="VisitCount.asp?StringSql=TimeDesc">顺</a> <a href="VisitCount.asp?StringSql=TimeAsc">逆</a>)</td>
    <td>访问文件</td>
    <td>手机类型 </td>
    <td>接受类型</td>
  </tr>
  <%
	iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not rs.EOF
For I = 0 To rs.Fields.Count - 1
	dim qqq,findid,mymark
	id=rs("id")
	phoneIp=rs("phoneIp")
	PhoneNumber=rs("PhoneNumber"):	if Len(PhoneNumber)<11 Then PhoneNumber="0000000000000"
	'PhoneNumber= Left(PhoneNumber,7) & "****"
	VisitDateTime=rs("VisitDateTime")
	PhoneUserAgent=rs("PhoneUserAgent")
	PhoneAccept=Left(rs("PhoneAccept"),10) & " 省略..."
	VisitFile=rs("VisitFile") 
next
	iRecordsShown = iRecordsShown + 1
%>
  <tr bgcolor="#FFFFFF"> 
    <td><%=Id%></td>
    <td><a href="ViewInfo.asp?FindId=<%=Id%>"><%=PhoneNumber%></a></td>
    <td><%=VisitDateTime%></td>
    <td><%=VisitFile%></td>
    <td><%=PhoneUserAgent%></td>
    <td><%=PhoneAccept%></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td colspan="7"><p align="center"> 
        <%
	rs.MoveNext
	Loop
End If
	If iPageCurrent <> 1 Then
%>
        <a href="VisitCount.asp?page=<%=iPageCurrent-1%>">上一页</a> 
        <%	End If
	If iPageCurrent < iPageCount Then%>
        <a href="VisitCount.asp?page=<%=iPageCurrent+1%>">下一页</a></p></td>
    <%End If
	rs.Close
	Set rs = Nothing
%>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td colspan="7" valign="top"><form name="form1" method="post" action="VisitCount.asp">
        <div align="center"> 
          <p>起始日期 
            <input name="StartDate" type="text" value="<%=Session("StartDate")%>" size="12">
            终止日期 
            <input name="LastDate" type="text" value="<%=Session("LastDate")%>" size="12">
            手机号码 
            <input name="ThePhone" type="text" id="ThePhone" value="<%=Session("ThePhone")%>" size="12">
            <br>
            <font color="#FF0000"> 
            <input name="IsSubmit" type="hidden" id="IsSubmit" value="yes">
            日期形式：<%=Date()%> 　手机号码形式：133 不添，为查询所有。</font> 
            <input type="submit" name="Submit" value="查询" >
          </p>
        </div>
      </form></td>
  </tr>
</table>
</body>
</html>
