<!--#include file="head.asp" -->
<!-- #Include File=chkpass.asp -->
<!--#include file="setup.asp" -->
<!--#include file="conn.asp" -->
<!--#include file="top2.asp" -->
<!--#include file="inc/prompt.inc" -->
<%
Response.Expires=0
dim typeid,sql,rs,soonhost,linkrs
typeid=request("typeid")
if typeid <> empty then
	typeid=typeid
	sql= "select * from linktype where trim(typeid)='"&typeid&"'"
	set rs=conn.execute (sql)  
	typehead=rs("type")
	state=rs("type")
   else
	typeid=""
	typehead="全部链接"
	state="全部链接"
   end if
call top2()
%>

<h1><font color="#FF0000" face="方正舒体"><%=linkname%> </font></h1>
<div align="center">
  <center>

<table width="770" border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0" height="17" >
  <tr valign="middle">
    <td width="52%" bgcolor="#FFFFFF" height="17">
    <a href="<%=homepage%>" style="text-decoration: none"><font color="#000000">回主页</font></a> 
      &gt;&gt; <a href="index.asp" style="text-decoration: none">
    <font color="#000000">友情链接</font></a> &gt;&gt; <%=typehead%>网站分类： 
      <select size="1" name="D1" onChange="MM_goToURL('parent',this.value);return document.MM_returnValue">
          <option>选择分类</option>
          <%
Set rs= Server.CreateObject ("ADODB.RecordSet")
rs.open "select * from linktype ",conn,1,3 
soonhost=0
DO WHILE NOT soonhost = rs.RecordCount %> 
          <option value="ad_view.asp?typeid=<% =rs("typeid") %>">  <%=rs("type")%></option>
          <% soonhost=soonhost+1
             rs.movenext
loop
'_________________________________________________________________________计算友情链接数
Set rs= Server.CreateObject ("ADODB.RecordSet")
sqllink="select * from link"
rs.open (sqllink),conn,1,3
total=rs.RecordCount
'_________________________________________________________________________计算友情链接数
Rs.Close
Set Rs=Nothing
%> 
      </select></td>
    <td  width="48%" bgcolor="#FFFFFF" height="17"> 
      <div align="right">&nbsp;<a href="ad_type.asp" target="_blank" style="text-decoration: none"><font color="#000000">分类管理</font></a> 
        <a href="index.asp" style="text-decoration: none"><font color="#000000">退出管理</font></a>
        <a href="ad_pass.asp" style="text-decoration: none">
        <font color="#000000">密码设定</font></a> 链接数 <%=total%></div>
    </td>
  </tr>
</table>    
    
  </center>
</div>
    
<br>
<div align="center">
  <center>
<table border=1 cellpadding=2 cellspacing=0 width=770 bordercolor=#C0C0C0 style="border-collapse: collapse">
  <tr align="center"> 
    <td class=td height=15 width=120>网站名称</td>
    <td class=td height=20 width=92>图标</td>
    <td class=td height=20 width=346>网站内容</td>
    <td class=td height=15 width=71>站长</td>
    <td class=td height=15 width=74>加入日期</td>
    <td class=td height=15 width=42>删除</td>
  </tr>
  <%
'__________________________________________________________________________________
set linkrs = Server.CreateObject("ADODB.RecordSet")
linkrs.pagesize=MaxPerPage
if typeid <> "" then

	select case arrange
		case 0
		sql="select * from link where type="&typeid&" order by addtime asc"	
		case 1
		sql="select * from link where type="&typeid&" order by addtime desc"
		case 2
		sql="select * from link where type="&typeid&" order by hit desc"
		case 3
		sql="select * from link where type="&typeid&" order by homepage asc"
	end select

else

	select case arrange
		case 0
		sql="select * from link  order by addtime asc"	
		case 1
		sql="select * from link  order by addtime desc"
		case 2
		sql="select * from link  order by hit desc"
		case 3
		sql="select * from link  order by homepage asc"
	end select
end if
linkrs.open sql,conn,1,3

'response.write sql 测试sql
'response.end

howmanyfields=linkrs.Fields.Count-1   '字段数

'__________________________________________________________取得当前页
If trim(Request("Page"))<>"" then '如果页数不为空
	CurrentPage= CLng(request("Page")) '指定当前页
	If CurrentPage> linkrs.PageCount then   '
		CurrentPage = linkrs.PageCount 
	End If 
Else 
	CurrentPage= 1 
End If 
'__________________________________________________________

if linkrs.eof then
	response.write "</table>"
	errmsg=errmsg+"<br>"+"<li>还没有记录,请返回!!"
	founderr=true
	call error2()
	response.end
		
else 
	totalPut=linkrs.recordcount
	if CurrentPage<>1 then 
		if (currentPage-1)*MaxPerPage<totalPut then 
			linkrs.move(currentPage-1)*MaxPerPage 
			
		end if 
	end if
end if	
i=0
do while not linkrs.eof and i < maxperpage 

response.write "<td class=td1 align='center' height='20' class=td><a href="&linkrs("url")&">"&linkrs("homepage")&"</a></td>"

logo=linkrs("image")
if logo="http://" then
	logo="image/nologo.gif"                     
end if 
                     
response.write "<td class=td2> <img src=" &logo& " width='88' height='31' class=td></td>"
response.write "<td  class=td1 height='20' class=td>"&linkrs("message")&"</td>"
response.write "<td class=td2 align='center' height='20' class=td><a href=mailto:" &linkrs("e_mail")& ">" &linkrs("username")&"</a></td>"
response.write "<td class=td1 align='center' height='20' class=td>" & (linkrs("addtime")) & "</td>"
response.write "<td align='center' class=td2  ><a href=ad_operate.asp?action=del&id="&linkrs("id")&" target='_blank'><img  border=0 src=image/del.gif></a></td>"

Response.Write "</TR>"
i=i+1
linkrs.movenext 
loop


'__________________________________________________________________________________

dim n,k 
	if (totalPut mod MaxPerPage)=0 then  'n表示总页数
		n= totalPut \ MaxPerPage
	else  
		n= totalPut \ MaxPerPage + 1  
	end if
k=currentPage
%> 
</table>

  </center>
</div>

<br>
<center>
<div align="center">
  <center>
<table border="0" cellspacing="0" cellpadding="0" width=770 style="border-collapse: collapse" bordercolor="#111111">
  <tr  bgcolor="#a2c8f0"> 
    <td class=td width="751" bgcolor="#FFFFFF">
      <div align="right">
        <select size="1" name="D2" onChange="MM_goToURL('parent',this.value);return document.MM_returnValue">
          <option>跳转页数</option>
          <%
soonhost=0
DO WHILE NOT soonhost = n %>
          <option value="ad_view.asp?typeid=<%=typeid%>&Page=<% =soonhost+1 %>"><% =soonhost+1 %></option>
          <% soonhost=soonhost+1
loop
%>
        </select>
        　</div>
</body>
</html>
</div>
<!--#include file="foot.inc" -->