<!--#include file="conn.asp"-->
<%
'-------------------------------------
'功能：显示所有友情链接页，带详细查找功能
'更新：2004-12-27 19:02
'作者：未知-部落忍者
'演示：http://www.0cc.cn/link/
'-------------------------------------
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询网站点击_<%=WebName&ChannelName%>_本程序由[★零星部落★（0cc.cn)]提供</title>
<link rel="stylesheet" href="style.css">
<style type="text/css">
<!--
.style1 {color: #0000FF}
-->
</style>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<%
dim find,webtype,pl
dim rs,sql
dim condition,linkstr
find=hx.checkstr(trim(request("find")),50)
webtype=request("webtype")

sql="select * from CL_Link"
condition = " where 1=1 " 

pl=request("pl")
if pl="" then
pl="inp"
end if
linkstr = "pl=" & pl

if webtype="" or not isnumeric(webtype) then
webtype=0 
elseif webtype>0 then
condition = condition & " and webtype="&webtype
end if
linkstr = linkstr & "&webtype="&webtype


if find<>"" then
condition = condition & " and (sitename like '%"&find&"%' or siteintro like '%"&find&"%' or siteurl like '%"&find&"%')"
linkstr = linkstr & "&find="&find
end if


'分页信息
dim PageNo
PageNo=Request.QueryString("PageNo")
if PageNo="" or not isnumeric(PageNo) then
PageNo=1
else
PageNo=int(PageNo)
end if

'普通sql语句
sql=sql & condition &" ORDER BY "&pl&" DESC"

%> 
<!--#include file="top.asp"-->
<table border="0" align="center" cellpadding="0" cellspacing="0" class="main_title1">
  <tr> 
    <td align="center"><a href="index.asp">系统使用说明</a>&nbsp;|&nbsp;<a href="addlink.asp">申请友情链接</a>&nbsp;|&nbsp;<a href="morelink.asp"><font color="#0000FF">查询网站点击</font></a>&nbsp;|&nbsp;<a href="editlink.asp">管理网站信息</a>&nbsp;|&nbsp;<a href="getcode.asp" class="style1">重获链接代码</a>&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="0" class="main_tdbg">
  <tr> 
    <td height="30">您的位置:<a href="<%=WebUrl%>">首页</a> -- <a href="index.asp"><%=ChannelName%></a> -- <a href="morelink.asp"><font color="#0000FF">查询网站点击</font></a></td>
  </tr>
</table>
<%if webtype=0 then%>
<table border="0" align="center" cellpadding="2" cellspacing="0" class="main_tdbg">
  <tr> 
    <td width="25%" valign="top"><table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolorlight=#000000 bordercolordark=#FFFFFF>
        <tr> 
          <td height="20" align="center" class="main_title2">今日点入排行</td>
        </tr>
        <tr> 
          <td height="115" valign="top"> 
            <%call showtop(1,1)%>
          </td>
        </tr>
      </table></td>
    <td width="25%" valign="top"><table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolorlight=#000000 bordercolordark=#FFFFFF>
        <tr> 
          <td height="20" align="center" class="main_title2">总计点入排行</td>
        </tr>
        <tr> 
          <td height="115" valign="top"> 
            <%call showtop(1,2)%>
          </td>
        </tr>
      </table> </td>
    <td width="25%" valign="top"><table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolorlight=#000000 bordercolordark=#FFFFFF>
        <tr> 
          <td height="20" align="center" class="main_title2">今日点出排行</td>
        </tr>
        <tr> 
          <td height="115" valign="top"> 
            <%call showtop(2,1)%>
          </td>
        </tr>
      </table></td>
    <td width="25%" valign="top"><table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolorlight=#000000 bordercolordark=#FFFFFF >
        <tr> 
          <td height="20" align="center" class="main_title2">总计点出排行</td>
        </tr>
        <tr> 
          <td height="115" valign="top"> 
            <%call showtop(2,2)%>
          </td>
        </tr>
      </table></td>
  </tr>
</table>
<%end if%>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" class="main_tdbg">
  <tr> 
    <td> 
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <form method="Get">
          <tr> 
            <td align="center" valign="middle"> <p>关键字： 
                <input name="find" type="text" value="<%=find%>" size="15" maxlength="20">
                网站分类： 
                <select name="webtype" size="1">
                  <option value="">全部类别</option>
                  <%hx.listwebtype(webtype)%>
                </select>
                排序： 
                <select name="pl" size="1">
                  <option value="inc"<%if pl="inc" then%> selected<%end if%>>总计点入</option>
                  <option value="inj"<%if pl="inj" then%> selected<%end if%>>今天点入</option>
                  <option value="inp"<%if pl="inp" then%> selected<%end if%>>平均点入</option>
                  <option value="outc"<%if pl="outc" then%> selected<%end if%>>总计点出</option>
                  <option value="outj"<%if pl="outj" then%> selected<%end if%>>今天点出</option>
                  <option value="outp"<%if pl="outp" then%> selected<%end if%>>平均点出</option>
                  <option value="indate"<%if pl="indate" then%> selected<%end if%>>点入时间</option>
                  <option value="outdate"<%if pl="outdate" then%> selected<%end if%>>点出时间</option>
                  <option value="fromdate"<%if pl="fromdate" then%> selected<%end if%>>统计时间</option>
				  <option value="dateandtime"<%if pl="dateandtime" then%> selected<%end if%>>加入时间</option>
                </select>
                <input name="submit" type="submit" value="查 询"></td>
          </tr>   </form>
		  <tr> 
            <td height="30" align="center"><%hx.showPageInfo "CL_link","username",condition,PageNo,MaxPageSize,linkstr%>
			</td>
          </tr>
      
      </table> </td>
  </tr>
</table> 

<table border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight=#000000 bordercolordark=#FFFFFF class="main_tdbg">
 <%
	set rs=server.createobject("adodb.recordset")
	rs.open sql,conn,1,1
   if not rs.eof then
	rs.PageSize = MaxPageSize
	rs.AbsolutePage = PageNo 
	dim i
	i=0   
	%>
  <tr align="center" class="main_title1"> 
    <td width="100">网站名称</td>
    <td width="92">链接图标</td>
    <td width="92">网站类别</td>
    <td width="102">网站登记时间</td>
    <td width="102">开始统计时间</td>
    <td width="102">最后点入时间</td>
    <td width="102">最后点出时间</td>
  </tr>
  <%

  
  Do While Not rs.EOF and i<MaxPageSize%>
  <tr align="center"> 
    <td><a href="http://<%=hx.BaseUrl%>out.asp?username=<%=rs("username")%>" target="_blank"><%=rs("sitename")%></a></td>
    <td><a href="http://<%=hx.BaseUrl%>out.asp?username=<%=rs("username")%>" target="_blank"><img src=<%=hx.htmlencode2(rs("sitelogo"))%> width=88 height=31 alt="网址:<%=hx.htmlencode2(rs("siteurl"))%>" border="0"></a></td>
    <td><%=hx.showwebtype(rs("webtype"))%></td>
    <td><%=rs("dateandtime")%></td>
    <td><%=rs("fromdate")%></td>
    <td><%=rs("indate")%></td>
    <td><%=rs("outdate")%></td>
  </tr>
  <tr> 
    <td align="center" bgcolor="#FDF0F9">简　介</td>
    <td colspan="6" bgcolor="#FDF0F9"><%=hx.htmlencode2(rs("siteintro"))%></td>
  </tr>
  <tr> 
    <td align="center">贡献统计</td>
    <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td>[你站]对[我站]:总计点入 <%=rs("inc")%> 今天点入 <%=rs("inj")%> 平均点入 <font color=#00009F><%=formatnumber(rs("inp"),2,-1)%></font></td>
        </tr>
        <tr> 
          <td>[我站]对[你站]:总计点出 <%=rs("outc")%> 今天点出 <%=rs("outj")%> 平均点出 <font color=#00009F><%=formatnumber(rs("outp"),2,-1)%></font></td>
        </tr>
      </table></td>
  </tr>
  <tr bgcolor="#8cc3de"> 
    <td height="5" colspan=7></td>
  </tr>
  <%  
i=i+1  
rs.MoveNext  
Loop  
else
%>
  <tr> 
    <td height=80 colspan=7> <div align="center"><B>没有找到你所查询的网站</B></div></td>
  </tr>
  <%
end if  
rs.close
set rs=nothing

CloseDatabase

%>
</table>
<!--#include file="under.asp"-->
<%
	Function ShowTop(x,y)
		Dim OutStr,conditionstr
		Dim rs,sql,i
		if y=2 then
			if x=1 then 
				conditionstr=" where inc>0 order by inc desc"
			else
				conditionstr=" where outc>0 order by outc desc"			
			end if
		sql="select top 5 sitename,inc,outc,username from CL_link "&conditionstr
		else
			if x=1 then 
				conditionstr=" where inj>0 order by inj desc"
			else
				conditionstr=" where outj>0 order by outj desc"			
			end if		
		sql="select top 5 sitename,inj,outj,username from CL_link "&conditionstr		
		end if
		OutStr = "<table cellpadding=1 cellspacing=0 border=0>"
		set rs=hx.Execute(sql)
		if rs.eof then
			OutStr= OutStr & "<tr><td align=center>暂时还没有数据</td></tr>"		
		else
		do while not rs.eof and i<5
			OutStr= OutStr & "<tr><td width=120>"
			OutStr= OutStr & "<img src=images/icon.gif> "
			OutStr= OutStr & " <a href=out.asp?username="&rs(3)&" target=_blank>"&rs(0)&"</a>"
			OutStr= OutStr & "</td><td>"			
			if x=1 then
			OutStr= OutStr & " in:"&rs(1)
			else
			OutStr= OutStr & " out:"&rs(2)
			end if				
			OutStr= OutStr & "</td><tr>"
			i=i+1
			rs.movenext
		loop
		end if
		OutStr= OutStr & "</table>"
		Response.Write OutStr
	End Function
%>
</body>
</html>