<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="inc/page.asp"-->
<%
word=trim(request("word"))
anclassid=request("anclassid")
pt=request("pt")
tuij=request("tuij")

canshu1=""
canshu3="word="&word&"&anclassid="&anclassid&"&pt="&pt&"&tuij="&tuij&"&"&canshu1&""
canshu2="page="&page&"&"&canshu3&""

select case action

case "add"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from com_link",conn,1,3
rs.addnew
rs("link_namecn")=trim(request("link_name2"))
rs("link_urlcn")=trim(request("link_url2"))
rs("bookpicm")=trim(request("bookpicm"))
if request("bookpicm")="" then
rs("anclassid")=0
else
rs("anclassid")=1
end if
rs("sh")=1
rs.update
rs.close
response.write "<script language=javascript>alert('成功添加了新的友情链接！');window.location.href='manage_link.asp';</script>"

response.redirect "manage_link.asp"
response.End


case "inputedit"
attrKey = split(Trim(Request("id")), "$")(0)
index = split(Trim(Request("id")), "$")(1)  
set rs=server.createobject("adodb.recordset")
rs.open "select link_namecn,link_urlcn,link_nameen,link_urlen,bookpicm from com_link where link_id="&index&" ",conn,1,3
rs(""&attrKey&"")=Trim(Request("value"))
rs.update
rs.close

Response.Write ""&trim(Request("value"))&""
Response.end() 

case "del"
id=replace(request("id")," ","")
id=split(id,",")
for i=0 to UBound(id)
conn.execute("delete from com_link where link_id="&id(i))
next
response.Write "<script>location='manage_link.asp'</script>"

case "order"
pi=REQUEST("pi")
pi=REPLACE(pi,", ",",")
SQL5="SELECT * from com_link where link_id IN ("&pi&")"
SET RS5=SERVER.CREATEOBJECT("ADODB.RECORDSET")
rs5.open sql5,conn,1,3
while not rs5.eof 
RS5("pid")=REQUEST("pid"&RS5("link_id"))
RS5.UPDATE
RS5.MOVENEXT
wend
response.Write "<script>location='?"&canshu2&"'</script>"

case "sh"
id=replace(request("id")," ","")
id=split(id,",")
for i=0 to UBound(id)
conn.execute("update com_link set sh=0 where link_id="&id(i))
next
response.Write "<script>location='?"&canshu2&"'</script>"
case "sh2"
id=replace(request("id")," ","")
id=split(id,",")
for i=0 to UBound(id)
conn.execute("update com_link set sh=1 where link_id="&id(i))
next
response.Write "<script>location='?"&canshu2&"'</script>"
end select
%>
<!--#include file="top.asp"-->
<div id="container">
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="?action=pageadd"><img src="images/but_1.gif" alt="添加" ></a></li>
 <li><img src="images/but_2.gif" alt="排序"  onclick="form1.action='?action=order&<%=canshu2%>';form1.submit();"></li>
 <li><img src="images/but_3.gif" alt="删除"  onclick="form1.action='?action=del&<%=canshu2%>'; ConfirmDel() "></li>
 <li><a href="?pt=yes"><img src="images/but_13.gif" alt="未审核" ></a></li>
 <li><a href="?tuij=yes"><img src="images/but_14.gif" alt="已审核" ></a></li>
 <li><a href="?tid=<%=tid%>"><img src="images/but_7.gif" alt="全部" ></a></li>
 <li><img src="images/but_8.gif" alt="刷新" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" onClick="window.print() "/></li>
<form name="form_search" method="post" action="?<%=canshu1%>">
 <li class="right">
<input name="word" type="text" id="word" class="s_b"><input type="image" name="Submit22" src="images/ss_b.gif" value="搜索" class="s_c" align="absmiddle"></li>
</form>
</div>


<%
if word<>"" then
sql= "select * from com_link where link_namecn like'%"&word&"%' order by pid asc,link_id desc"
elseif pt<>"" then
sql= "select * from com_link where sh=0 order by pid asc,link_id desc"
elseif tuij<>"" then
sql= "select * from com_link where sh=1 order by pid asc,link_id desc"
elseif anclassid<>"" then
sql= "select * from com_link where anclassid="&anclassid&" order by pid asc,link_id desc"
else
sql= "select * from com_link order by pid asc,link_id desc"
end if
set rs=server.createobject("adodb.recordset")                     
rs.open sql,conn,1,1                     
if rs.eof and rs.bof then                     
response.write conn_eof
else 
page1("18")
i=1	
set link_namecn=rs("link_namecn")
set link_urlcn=rs("link_urlcn")
set link_nameen=rs("link_nameen")
set link_urlen=rs("link_urlen")
set link_bookpicm=rs("bookpicm")
set link_pid=rs("pid")
set link_sh=rs("sh")
set link_id=rs("link_id")
set link_date=rs("link_date")
%>
<%if word<>"" then%><div class="tablesearch">您搜索的关键字是：<font color=#ff6600><%=word%></font>，共搜索到 <%=rs.recordcount%> 条信息。 </div><%end if%>
<form name="form1" id="form1" method="post" action="?<%=canshu2%>">
<div class="tableAll titlebgcolor">
<ul>
 <li style="width:30px"><input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form);" ></li>
<!--<li style="width:50px;">图片</li>-->
 <li style="width:150px"><%=language_cn%>标题（点击修改）</li>
 <li style="width:220px"><%=language_cn%>网址（点击修改）</li>
<!--<li style="width:250px;">图片地址</li>-->
 <%if Const_webEn =1 then%>
 <li style="width:150px"><%=language_en%>标题（点击修改）</li>
 <li style="width:220px"><%=language_en%>网址（点击修改）</li>
<%end if%>
 <li style="width:50px">审核</li>
 <li style="width:50px">排序</li>
 </ul>
</div>
<%
do while not rs.eof and i<=rs.pagesize
%>
<div class="tableAll trbgcolor">
<ul>
 <li style="width:30px"><input type="checkbox" name="ID"  value="<%=link_id%>"></li>
<!-- <li style="width:50px;"><%if link_bookpicm<>"" then%><img src=../<%=link_bookpicm%> height="16" border="0"><%end if%>&nbsp;</li>-->
 <li style="width:150px"><span id="link_namecn$<%= link_id %>" class="edit"><%=link_namecn%></span></li>
 <li style="width:220px"><span id="link_urlcn$<%= link_id %>" class="edit"><%=link_urlcn%></span></li>
<!--<li style="width:250px"><span id="bookpicm$<%= link_id %>" class="edit"><%=link_bookpicm%></span></li>-->

 <%if Const_webEn =1 then%>
 <li style="width:150px"><span id="link_nameen$<%= link_id %>" class="edit"><%=link_nameen%></span></li>
 <li style="width:220px"><span id="link_urlen$<%= link_id %>" class="edit"><%=link_urlen%></span></li>
<%end if%>
 <li style="width:50px"><%if link_sh=1 then%><a href="?action=sh&id=<%=link_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=sh2&id=<%=link_id%>&<%=canshu2%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
 <li style="width:50px"><input name="pid<%=link_id%>" type="text" id="pid<%=link_id%>" value="<%=link_pid%>" size="2"> 
        <input name="pi" type="hidden" id="pi" value="<%=link_id%>"></li>
 </ul>
</div>

<%i=i+1
rs.movenext
loop
%>

</form>

<div id="divStayTop" class="bottom titlebgcolor">
<%call page2(5,""&canshu3&"&")%>
</div>
<%
end if
rs.close
set rs=nothing
%>
<%
select case action
case "pageadd" 
%>
<div class="tableAll titlebgcolor">
<ul>
 <li style="width:30px">&nbsp;</li>
 <li style="width:700px;">添加</li>
</ul>
</div>

<form name="myform" method="post" action="?action=add" >
<div class="tableAll trbgcolor">
 <li style="width:30px">&nbsp;</li>
 <li style="width:80px">添加新的链接 </li>
<!--<li><input type="text" name="bookpicm" id="bookpicm" size="60" /></li>
 <li><iframe ID="UploadFiles" src="update_file.asp?editname=bookpicm&filepath=upload_files" frameborder=0 scrolling=no width="200" height="20"></iframe></li>
</div>
<div class="tableAll trbgcolor">
 <li style="width:30px">&nbsp;</li>
 <li style="width:80px">&nbsp;</li>-->
 <li><font color="#990000">
 标题： <input name="link_name2" type="text" id="link_name2"> 
              网址：http:// <input name="link_url2" type="text" id="link_url2" size="30"> 
              <input class="button" type="submit" name="Submit3" value="添加" >
 </font></li>
</div>
</form>

<%
end select
%>
</div>
<script language="JavaScript" type="text/JavaScript" src="js/jquery.latest.js"></script> 
<!--#include file="footer.asp"-->