<!--#include file="sd_mdb.asp"-->
<%
if session("User")="" then
	response.write"<SCRIPT language=JavaScript>alert('您尚未登录！');location.href=""sd_admin_login.asp"";</SCRIPT>"
end if
%>
<%
t1=trim(request("t1"))
t2=trim(request("t2"))
set sd=server.createobject("adodb.recordset")
sd.open "select * from sd_title",conn,1,3
sd_sd=sd("sd_sd")
sd.close
Set fs=Server.CreateObject("Scripting.FileSystemObject")
IF request("C")="D" THEN
sd_id=trim(request("id"))
ArrayID = Split(sd_id,",")
For i=0 TO ubound(ArrayID)
Conn.execute("delete * from [sd_web] where sd_id="&CInt(ArrayID(i))&"")
Next
For i=0 TO ubound(ArrayID)
Conn.execute("delete * from [sd_pinglun] where sd_show_id in("&CInt(ArrayID(i))&")")
Next
response.Write("<script>alert(""删除成功"");window.location.href='sd_web.asp';</script>")
Response.end
END IF
%>
<HTML>
<HEAD>
<title>爱链接友情链接交换交易网站—雨过天晴工作室 www.zzcodes.net</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<LINK href="images/Admin_css.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript>
function loadThreadFollow(t_id,b_id){
	var targetImg =eval("document.all.followImg" + t_id);
	var targetDiv =eval("document.all.follow" + t_id);
	
	if ("object"==typeof(targetImg)){
		if (targetDiv.style.display!='block'){
			targetDiv.style.display="block";
			
		}else{
			targetDiv.style.display="none";
		}
	}
}
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
  }
function INtitle(addtitle) { 
var revisedtitle; 
revisedtitle = addtitle; 
document.form1.title.value=revisedtitle + document.form1.title.value; 
document.form1.title.focus(); 
return; 
}
function loadForm()
{
  editor.HtmlEdit.document.body.innerHTML=document.form1.Content.value;
  return true
}
</SCRIPT>
</HEAD>
<BODY>
<table width="95%" border="0" cellspacing="2" cellpadding="3"  align=center class="admintable" style="margin-bottom:5px;">
    <tr>
      <td height="25" bgcolor="f7f7f7">
<FORM name=sou1 action="?seo=1" method=POST>
    按名称：
    <input type="text" name="T1" size="10" class="s26" value="<%=trim(request("t1"))%>">
    <input type="submit" value="查 找" name="B1" class="bnt">
    </form></td>
      <td width="550" bgcolor="f7f7f7">
<input type="button" name="button" value="所有链接" class="bnt" onClick="window.location.href='?seo='" />
<input type="button" name="button" value="置顶链接" class="bnt" onClick="window.location.href='?seo=3'" />
</td>
    </tr>
</table>

<FORM name=thisForm action="?C=D" method=POST>
<%
dim ThisPage,Pagesize,Allrecord,Allpage
if request("page")="" then
  ThisPage=1		
else
  ThisPage=request("page")
end if
seo=request("seo")
set rs = Server.CreateObject("ADODB.RecordSet")
set rs1 = Server.CreateObject("ADODB.RecordSet")
Select Case seo
Case "1"
sql="select * from sd_web where sd_webname like '%"&trim(request("T1"))&"%' order by sd_id desc"
Case "3"
sql="select * from sd_web where sd_TopEndTime>now() order by sd_id desc"
Case "5"
sql="select * from sd_web where sd_classid="&trim(request("T2"))&" order by sd_id desc"
Case Else
sql="select * from sd_web order by sd_id desc"
End Select
rs.open sql,conn,1,1
if rs.eof then
response.write "<li>还没有数据！"
response.end
end if
rs.Pagesize=20
Pagesize=rs.Pagesize
Allrecord=rs.Recordcount
Allpage=rs.Pagecount
if ThisPage<1 then                           
ThisPage=1
end if
On Error Resume Next
rs.move (ThisPage-1)*Pagesize
k=0
%>
<table height="1" border="0" cellpadding="3"  cellspacing="1" bgcolor="#F2F9E8" class="admintable1">
  <tr>
    <td colspan="12" class="admintitle">所有链接管理</td>
  </tr>
  <tr bgcolor="E8FBD1" align="center">
    <td width="45" height="30">序号</td>
    <td>网站名称</td>
    <td>网址</td>
    <td width="75">链接分类</td>
    <td width="75">链接类型</td>
    <td width="75">链接价格</td>
    <td width="75">交易方式</td>
    <td width="125">更新时间</td>
    <td width="45">评论数</td>
    <td width="45">静态</td>
    <td width="45">更新</td>
    <td width="45">删除</td>
    <td width="45">选择</td>
  </tr>
  <%
  dim id
  do while not rs.eof
  id=rs("sd_id")
  %>
	<tr align="center" bgcolor="#FFFFFF">
	<td height="30"><%=k+1%></td>
	<td><a href="../sd_show.asp?id=<%=rs("sd_id")%>" target="_blank"><%if rs("sd_rgb")=1 then%><font color="#ff0000"><%elseif rs("sd_rgb")=2 then%><font color="#0000ff"><%else%><font color="#000000"><%end if%><%=rs("sd_WEBNAME")%></font></a><%if rs("sd_TopEndTime")>now() then Response.Write(" <a title='置顶到："&rs("sd_TopEndTime")&"'><font color='red'>[顶]</font></a>") end if%></td>
	<td><%=replace(replace(rs("sd_weburl"),"http://",""),"/","")%></td>
	<td><%set rsc = Server.CreateObject("ADODB.RecordSet")
sql = "select classid,sd_classname from sd_class where classid="&rs("sd_classid")&""
rsc.open sql, conn,1,1
%><a href="?t2=<%=rsc("classid")%>&seo=5"><%=rsc("sd_classname")%></a><%rsc.close
set rsc=nothing%></td>
   <td><%if rs("sd_lx")=1 then%>文字<%elseif rs("sd_lx")=2 then%>图片<%else%>图文<%end if%></td>
	<td><%if rs("sd_jg")=0 then%>商议<%else%><%=rs("sd_jg")%>元/月<%end if%></td>
	
	<td><%if rs("sd_jy")=1 then%>交换<%elseif rs("sd_jy")=2 then%>购买<%else%>出售<%end if%></td>
	<td title="<%=datevalue(rs("sd_REGTime"))%>"><%=rs("sd_REGTime")%></td>

	<td><%
Set TJCount=Server.CreateObject("Adodb.Recordset")
TJ_Sql="Select * from sd_pinglun where sd_show_id="&rs("sd_id")&""
TJCount.open TJ_Sql,conn,1,1
%>
<%=TJCount.RecordCount%>
<%
TJCount.close 
Set TJCount = Nothing
%></td><td><%if sd_sd=1 then%><%If (fs.FileExists(server.MapPath("../links")&"\"&rs("sd_weburl")&".html")) Then%><font color="#008000"><a href="sd_html.asp?id=<%=rs("sd_id")%>">已生成</a></font><%else%><a href="sd_html.asp?id=<%=rs("sd_id")%>"><font color="#FF0000">未生成</font></a><%end if%><%end if%><%if sd_sd=0 then%>动态<%end if%></td>
	<td><a href="sd_web_edit.asp?id=<%=trim(rs("sd_id"))%>">更新</A></td>
	<td><a onclick='{if(confirm("您确定删除吗？！")){return true;}return false;}' href="?C=D&id=<%=trim(rs("sd_id"))%>">删除</a></td>
	<td><input type="checkbox" name="id" value="<%=trim(rs("sd_id"))%>"></td>
	</tr>
    <%
    k=k+1
    rs.movenext
    if k>=Pagesize then exit do
	loop
	rs.close
    set rs=nothing
    set rs1=nothing
    closedb
	%>
<tr><td height="30" colspan="12"><input type="checkbox" name="chkall" onClick="javascript:CheckAll(this.form)"> 
  全选记录
  <input type="submit" value="删除" name="action" onClick="{if(confirm('确定删除选定的吗?')){this.document.thisForm.submit();return true;}return false;}">
  共有&nbsp;<font color="#CC5200"><%=Allrecord%></font>&nbsp;条记录 共 <font color="#CC5200"><%=Allpage%></font> 页 现在是第 <font color="#CC5200"><%=ThisPage%></font> 页
<%
if ThisPage<2 then     
response.write "<font color=""#808080"">首页</font>&nbsp;"
response.write "<font color=""#808080"">上一页</font>&nbsp;"     
else     
response.write "<a href=?page=1&t1="&trim(request("t1"))&"&t2="&trim(request("t2"))&"&seo="&seo&">首页</a>&nbsp;"
response.write "<a href=?page="&(ThisPage-1)&"&t1="&trim(request("t1"))&"&t2="&trim(request("t2"))&"&seo="&seo&">上一页</a>&nbsp;"     
end if
if Allpage-ThisPage<1 then     
response.write "<font color=""#808080"">下一页</font>&nbsp;"
response.write "<font color=""#808080"">尾页</font>&nbsp;"  
else     
response.write "<a href=?page="&(ThisPage+1)&"&t1="&trim(request("t1"))&"&t2="&trim(request("t2"))&"&seo="&seo&">下一页</a>&nbsp;"   
response.write "<a href=?page="&Allpage&"&t1="&trim(request("t1"))&"&t2="&trim(request("t2"))&"&seo="&seo&">尾页</a>&nbsp;"     
end if
%></td></tr>
</table>
</form>
<!--#include file="sd_copy.asp"-->
</BODY> 
</HTML>