<%
if session("user")="" then
response.redirect "login.asp"
end if 
%>
<!--#include file=cnn.asp -->
<%
Function getBody(infopageurl)
'ܣȡַָhtml
if infopageurl<>"" then
 dim xmlHttp
 set xmlHttp=server.createobject("MSXML2.XMLHTTP")
 xmlHttp.open "GET",infopageurl,false
 xmlHttp.send
 getBody=BytesToBstr(xmlhttp.responsebody,"GB2312")
 set xmlHttp=nothing
end if 
End Function
 
Function BytesToBstr(body,Cset) 
 dim objstream  
 set objstream = Server.CreateObject("adodb.stream")  
 objstream.Type = 1  
 objstream.Mode = 3  
 objstream.Open  
 objstream.Write body  
 objstream.Position = 0  
 objstream.Type = 2  
 objstream.Charset = Cset  
 BytesToBstr = objstream.ReadText  
 objstream.Close  
 set objstream = nothing 
End Function

readurl="http://www.sublink.cn/sitelist.asp?dns="&Request.ServerVariables("SERVER_NAME")
allpage = getBody(readurl)

Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
path=Server.MapPath("sitelist.xml") 
set TextFile=FileObject.CreateTextFile(path)
TextFile.Write(allpage)
%>
<body topmargin="10">
<%
if instr(allpage,"<xml") then
num=20
if request("page")<>"" then
page=request("page")
else
page=1
end if
movenum=page*num-num
set rs=server.CreateObject ("ADODB.RecordSet")
    strSourceFile = (path)
    Set objXML =Server.CreateObject("Microsoft.XMLDOM")  'һXML
    objXML.load(strSourceFile)  'XMLļڴ
	Set objNode=objXML.documentElement
	nCntChd=objNode.ChildNodes.length-1
	%>
<table border="0" align="center" cellpadding="1" cellspacing="0" style="font-size:12px">
  <tr> 
    <td width="280"><strong>Դ</strong></td>
    <td width="120"><strong>ı</strong></td>
    <td width="80"><strong>վ</strong></td>
    <td width="200"><strong>Դվ״̬</strong></td>
    <td align="center"><strong></strong></td>
  </tr>
</table>
<%
	i=(page-1)*num
	do while movenum<nCntChd and i<num*page and i<nCntChd+1
	    set objAtr=objNode.ChildNodes.item(i)
		linkurl= objAtr.childNodes.item(0).text
		linktxt= objAtr.childNodes.item(1).text
		part= objAtr.childNodes.item(2).text
		dns= objAtr.childNodes.item(3).text
		dir= objAtr.childNodes.item(4).text
		sure= objAtr.childNodes.item(5).text
		cpass= objAtr.childNodes.item(6).text
		
		tdir=Replace(dir,"set.asp","")
		sdir=Replace(tdir,"edit.asp","")
	sql="select * from [link] where back like '%"&dns&"%'"	
	rs.open sql,conn,1,1
    tpage="list"&right(len(dns)+len(Request.ServerVariables("SERVER_NAME")),1)&".asp"
%>
<table border="0" align="center" cellpadding="1" cellspacing="0" style="font-size:12px">
  <tr>
    <td width="280">http://<%=dns%></td>
    <td width="120"><a target="_blank" href="<%=linkurl%>"><font color="#000000"><%=linktxt%></font></a></td>
    <td width="80"><%=part%></td>
    <td width="200"> 
      <%if sure="False" then%>
      ɹע,״̬ 
      <%else%>
      ҳδSublinkϵͳ, 
      <%end if%>
    </td>
    <td align="center">
<%	if rs.eof then%>
<a target="_blank" href=changelink.asp?linkurl=<%=linkurl%>&linktxt=<%=linktxt%>&part=<%=part%>&dns=<%=dns%>&sdir=<%=sdir%>&cpass=<%=cpass%>><font color=#FF0000></font></a>
<%else%> 
<font color=#000000></font> 
<%end if%>
    </td>
   </tr>
</table>
<%	rs.close
    i=i+1
    loop	
    Set xml=nothing 
    Set objXML =nothing
	rs.pagesize=num
totalPage=1
do while num*totalPage<=nCntChd
totalPage=totalPage+1
loop
i=1
do while i<totalPage+1
pagelist=pagelist&"<a href=?page="&i&">["&i&"]</a> "
i=i+1
loop
%>
<table width="721" border="0" align="center" cellpadding="1" cellspacing="0" style="font-size:12px">
  <tr> 
    <td align="right">ҳʾ:<%=pagelist%></td>
  </tr>
</table>
<%
else
response.write allpage
end if
%>
</body>