<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0703") then Call ReturnError1()
	Dim Sql,RsVisitObj,SunNumAsp
	Sql = "Select * from FlowStatistic Order By VisitTime Desc"
	Set RsVisitObj = Server.CreateObject("ADODB.RecordSet")
	RsVisitObj.Open Sql,Conn,3,3
	SunNumAsp = RsVisitObj.RecordCount
%>
<html>
<head>
<title>来访者信息列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="../../CSS/css.css" rel="stylesheet">
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body topmargin="0" leftmargin="0" oncontextmenu="SelectSingleLog();showMenu(MouseRightMenu);return false;" >
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td valign="top">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <td width="6%" class="ButtonList"> <div align="center">选择</div></td>
    <td width="15%" class="ButtonList"> <div align="center">操作系统</div></td>
    <td width="17%" class="ButtonList"> <div align="center">浏览器</div></td>
    <td width="16%" class="ButtonList"> <div align="center">IP地址</div></td>
    <td width="28%" class="ButtonList"> <div align="center">地区</div></td>
    <td width="18%" class="ButtonList"> <div align="center">访问时间</div></td>
  </tr>
  <%if  RsVisitObj.Bof And RsVisitObj.Eof then%>
  <tr> 
    <td colspan="6" align="center"><font color="red">暂时没有记录</font></td>
  </tr>
  <% else %>
  <%
if not  RsVisitObj.Bof And not RsVisitObj.Eof  then 
	Dim page_size,page_no,page_total,record_all
	page_size=Request.QueryString("page_size")
	if page_size<=0 or page_size="" then page_size=20
	If isnumeric(Request.Form("PageNums")) then
		if Request.Form("PageNums")<>0 then
			page_size = Cint(Request.Form("PageNums"))
		end if
	End if
	page_no=request.querystring("page_no")
	if page_no<=1 or page_no="" then page_no=1	
	If Request.QueryString("page_no")="" then
		page_no=1
	end if
	RsVisitObj.PageSize=page_size
	page_total=RsVisitObj.PageCount
	if (cint(page_no)>page_total) then page_no=page_total
	RsVisitObj.AbsolutePage=page_no
	record_all=RsVisitObj.RecordCount
	Dim i
  	for i=1 to RsVisitObj.PageSize
    	if RsVisitObj.eof then exit for
%>
  <tr class="TempletItem"> 
    <td><div align="center"> 
        <input type="checkbox" name="SelectFlag" onClick="ClickFlag();" value="<%=RsVisitObj("ID")%>">
      </div></td>
    <td><div align="center"><%=RsVisitObj("OSType")%></div></td>
    <td><div align="center"><%=RsVisitObj("ExploreType")%></div></td>
    <td><div align="center"><%=RsVisitObj("IP")%></div></td>
    <td><div align="center"><%=RsVisitObj("Area")%></div></td>
	<td><div align="center"><%=RsVisitObj("VisitTime")%></div></td>
  </tr>
  <%
		RsVisitObj.MoveNext
	Next
end if
%>

	</table>
	</td>
	</tr>
	<tr>
<td height="18">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ButtonList">
  <tr height="1">
	  <td width="42%" height="18"><table width="99%" border="0" cellspacing="0" cellpadding="0">
		  <tr><form name="PGNum" method="post" action="">
			<td width="46%" valign="middle">   
			<div align="right">每页记录条数:						  </div></td>  
			<td width="21%" valign="bottom"><input name="PageNums" type="text" id="PageNums" size="10" value="<%=page_size%>">                          </td>
			<td width="33%" valign="top"><div align="center">
			  <input name="imageField" type="image" src="../Images/Submit.gif" border="0">
			</div></td>
		  </form>
		  </tr>
	   </table> </td>
	
	<td width="51%" height="25" valign="middle"> <div align="right">
		<% =  "NO.<b>"& page_no &"</b>,&nbsp;&nbsp;" %>
		<% = "Totel:<b>"& page_total &"</b>,&nbsp;RecordCounts:<b>" & record_all &"</b>&nbsp;&nbsp;&nbsp;"%>
		<%
			if Page_Total=1 then
					response.Write "&nbsp;<img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
					response.Write "&nbsp;<img src=../images/prePage.gif border=0 alt=上一页></img>&nbsp;"
					response.Write "&nbsp;<img src=../images/nextPage.gif border=0 alt=下一页></img>&nbsp;"
					response.Write "&nbsp;<img src=../images/endPage.gif border=0 alt=尾页></img>&nbsp;"
			else
				if cint(Page_No)<>1 and cint(Page_No)<>Page_Total then
					response.Write "&nbsp;<a href=?page_no=1&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)-1)&"&page_size="&page_size&"&Keywords="&Request("Keywords")&"><img src=../images/prePage.gif border=0 alt=上一页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)+1)&"&page_size="&page_size&"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="& Page_Total &"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/endPage.gif border=0 alt=尾页></img></a>&nbsp;"
				elseif cint(Page_No)=1 then
					response.Write "&nbsp;<img src=../images/First1.gif border=0 alt=首页></img></a>&nbsp;"
					response.Write "&nbsp;<img src=../images/prePage.gif border=0 alt=上一页></img>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)+1)&"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="& Page_Total &"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/endpage.gif border=0 alt=尾页></img></a>&nbsp;"
				else
					response.Write "&nbsp;<a href=?page_no=1&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)-1)&"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/prePage.gif border=0 alt=上一页></img></a>&nbsp;"
					response.Write "&nbsp;<img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
					response.Write "&nbsp;<img src=../images/endpage.gif border=0 alt=尾页></img>&nbsp;"
				end if
			end if
			%>
	</div></td>
	<td width="7%" valign="middle"><select onChange="ChangePage(this.value);" style="width:50;" name="select">
	  <% for i=1 to Page_Total %>
	  <option <% if cint(Page_No) = i then Response.Write("selected")%> value="<% = i %>">
	  <% = i %>
	  </option>
	  <% next %>
	</select></td>
  </tr>
</table>
  </td>
  </tr>
  </table>
  <%end if%>
  </body>
</html>
  <!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
  <div class="MouseRightItem" id="SelectAll" ExeFunction="SelectA();">全选</div>
  <div class="MouseRightItem" id="UnDoAll" ExeFunction="SelectB();">取消选择</div>
  <hr id="HR4">
  <div class="MouseRightItem" id="Del" ExeFunction="DelSelected();">删除</div>
  <div class="MouseRightItem" id="DelPage" ExeFunction="DelThisPage();">删除本页</div>
  <div class="MouseRightItem" id="DelTable" ExeFunction="DelAll();">删除全部</div>
  <hr id="HR6">
  <div class="MouseRightItem" id="UpPage" ExeFunction="PriPage();">上一页</div>
  <div class="MouseRightItem" id="DownPage" ExeFunction="NextPage();">下一页</div>
  <hr id="HR3">
  <div class="MouseRightItem" id="Refresh" ExeFunction="window.location.reload();">刷新</div>
   <hr id="HR4">
  <div class="MouseRightItem" id="Pros" ExeFunction="javascript:window.prompt('本页面路径属性' , '<%=Request.ServerVariables("SCRIPT_NAME")%>');">路径属性</div>
</div>



<script language="JavaScript">
var AllSelect=false;
var NoneSelect=true;
var CurrPageIndex='<% = page_no %>';
var TotalPageNum='<% = page_total %>';
var SunNum = '<% = SunNumAsp %>';
Del.className='MenuItemDisable';
FlipPage();
function FlipPage()
{
	if (CurrPageIndex=='1')
	{
		UpPage.className='MenuItemDisable';
	}
	if (CurrPageIndex==TotalPageNum)
	{
		DownPage.className='MenuItemDisable';
	}
	SetMenu();
}
function SetMenu()
{
	if (AllSelect==true)
	{
		UnDoAll.className='MouseRightItem';
		SelectAll.className='MenuItemDisable';
	}
	else
	{
		if (NoneSelect==true)
		{
			SelectAll.className='MouseRightItem';
			UnDoAll.className='MenuItemDisable';
		}
		else
		{
			SelectAll.className='MouseRightItem';
			UnDoAll.className='MouseRightItem';
		}
	}
}
function SelectA()
{
	for (var i=0;i<=document.all.SelectFlag.length-1;i++)
	{
		document.all.SelectFlag(i).checked=true;
	}
	if (SunNum==1) document.all.SelectFlag.checked=true;
	else document.all.SelectFlag(0).onclick();
	AllSelect=true;
	NoneSelect=false;
	SetMenu();
}
function SelectB()
{
	for (var i=0;i<=document.all.SelectFlag.length-1;i++)
	{
		document.all.SelectFlag(i).checked=false;
	}
	if (SunNum==1) document.all.SelectFlag.checked=false;
	else document.all.SelectFlag(0).onclick();
	AllSelect=false;
	NoneSelect=true;
	SetMenu();
}
function DelSelected()
{
	var ID='';
	var ReturnValue='';
	ID=GetFlagValue();
	OpenWindow('Visit_DataDel.asp?ID='+ID,0,0,window);
	window.location.reload();
	ChangePage(CurrPageIndex);
}
function ClickFlag()
{
	var TempStr=GetFlagValue();
	if (TempStr=='') Del.className='MenuItemDisable';
	else Del.className='MouseRightItem';
	AllSelect=false;
	NoneSelect=false;
	SetMenu();
}
function GetFlagValue()
{
	var TempStr='';
	for (var i=0;i<=document.all.SelectFlag.length-1;i++)
	{
		if (document.all.SelectFlag(i).checked==true)
		{
			if (TempStr=='') TempStr=document.all.SelectFlag(i).value;
			else  TempStr=TempStr+'*'+document.all.SelectFlag(i).value;
		}
	}
	if (SunNum=1)
		{
			if (document.all.SelectFlag.checked==true)
			{
				if (TempStr=='') TempStr=document.all.SelectFlag.value;
				else  TempStr=TempStr+'*'+document.all.SelectFlag.value;
			}
		 }
	return TempStr
}

function SelectSingleLog()
{
	var el=event.srcElement;
	if (SunNum<=0)
	{
	 SelectAll.className = 'MenuItemDisable';
	 DelPage.className = 'MenuItemDisable';
	 DelTable.className = 'MenuItemDisable';
	 UpPage.className = 'MenuItemDisable';
	 }
	if (el.name=='SelectFlag')
	{
		el.checked=true;
		el.onclick();
		AllSelect=false;
		NoneSelect=false;
		SetMenu();	
	}
}
function ChangePage(PageNum)
{
	window.location.href='?page_no='+PageNum;
}
function PriPage()
{
	var PageNum='<% = cint(page_no) - 1 %>';
	ChangePage(PageNum);
}
function NextPage()
{
	var PageNum='<% = cint(page_no) + 1 %>';
	ChangePage(PageNum);
}
function DelThisPage()
{
	var ID='';
	var ReturnValue='';
	ID=GetPageValue();
	OpenWindow('Visit_DataDel.asp?ID='+ID,100,100,window);
	window.location.reload();
	ChangePage(CurrPageIndex);
}
function DelAll()
{
	var ID='';
	var ReturnValue='';
	ID=GetAllValue();
	OpenWindow('Visit_DataDel.asp?ID='+ID,0,0,window);
	window.location.reload();
	ChangePage(CurrPageIndex);
}
function GetPageValue()
{
	var TempStr='';
	if (SunNum==1)
		{
			TempStr=document.all.SelectFlag.value;
		 }
	else
	{
		for (var i=0;i<=document.all.SelectFlag.length-1;i++)
		{
			if (TempStr=='') TempStr=document.all.SelectFlag(i).value;
			else  TempStr=TempStr+'*'+document.all.SelectFlag(i).value;
		}
	}
	return TempStr
}
function GetAllValue()
{
	var TempStr='';
	if (SunNum==1) TempStr=TempStr+'*'+document.all.SelectFlag.value;
	else
		{
		 for (var i=0;i<=document.all.SelectFlag.length-1;i++)
		  {
			TempStr=TempStr+'*'+document.all.SelectFlag(i).value;
		   }
		 }
	return TempStr
}
</script>
<%
Set Conn = Nothing
RsVisitObj.close
Set RsVisitObj = Nothing
%>