<!--#include file="system_manage.asp"-->
<%
Dim postid,swebname,sweburl,sweblogo,swebcontent

   Call DBConnBegin()
	  Set rs = server.createobject("adodb.recordset")
Select Case Request("action")
Case "del"
id=tx_common.checkstr(request.querystring("id"),1)
sql="delete from tx_link where id="&id
tx_common.execute sql
 Call tx_common.message("·友情连接删除成功<br>·如果你的浏览器不支持跳转，<a href='admin_link.asp'>点击这里返回</a><meta http-equiv=refresh content='3;URL=admin_link.asp'>",1)
  Case "addsave"
 postid=request("id")
swebname=request.Form("webname")
sweburl=request.Form("weburl")
sweblogo=request.Form("weblogo")
swebcontent=request.Form("webcontent")
If swebname="" Or sweburl = "" Then Call tx_common.message("·联盟标题或者连接不能为空<meta http-equiv=refresh content='1;URL=admin_announce.asp'>",0)
      'Save
	  If postid<>"" Then 
	 rs.open "select * from tx_link where id="&postid,conn,1,3
	 Else
	 rs.open "tx_link",conn,1,3
	  rs.AddNew
	  End If 
  rs("webname")=swebname
  rs("weburl")=sweburl
  rs("weblogo")=sweblogo
  rs("webcontent")=swebcontent
	  rs.update
	  rs.close
	  Call tx_common.message("·友情连接添加成功<br>·如果你的浏览器不支持跳转，<a href='admin_link.asp'>点击这里返回</a><meta http-equiv=refresh content='3;URL=admin_link.asp'>",1)
Case "add"
content=tx_tables.formtop("?action=addsave","添加友情连接")
content =content & tx_tables.inputs("联盟标题","webname","text","")
content =content & tx_tables.inputs("联盟地址","weburl","text","http://")
content =content & tx_tables.inputs("联盟logo","weblogo","text","")
content =content & tx_tables.textarea("联盟简介","webcontent","")
'content =content & tx_tables.inputs("联盟简介","webcontent","text","")
content =content & tx_tables.formfoot
Case "edit"
	 rs.open "select * from tx_link where id="&tx_common.checkstr(request.querystring("id"),1),conn,1,3
content = tx_tables.formtop("?action=addsave&id="&rs("id"),"更改友情连接")
content =content & tx_tables.inputs("联盟标题","webname","text",rs("webname"))
content =content & tx_tables.inputs("联盟地址","weburl","text",rs("weburl"))
content =content & tx_tables.inputs("联盟logo","weblogo","text",rs("weblogo"))
content =content & tx_tables.textarea("联盟简介","webcontent",rs("webcontent"))
'content =content & tx_tables.inputs("联盟简介","webcontent","text",rs("webcontent"))
content = content & tx_tables.formfoot
  Case Else

content =  "<table width='100%' cellpadding=3 cellspacing=1 class=td1>"
content = content & "<tr class=td4><td colspan=4><strong>友情连接列表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HRef='?action=add'>发布友情连接</a></strong></td></tr>"
content =content & "<tr class=td2><td nowap>ID</td><td width='40%'>联盟标题</td><td width='20%'>联盟logo</td><td width='10%'>操作</td></tr>"
Set rso=conn.execute("select * from tx_link order by id desc")
If Not rso.bof And Not rso.eof Then
Do While Not rso.bof And Not rso.eof 
content =content & "<tr class=td2><td>"&rso("id")&"</td><td><a href="&rso("weburl")&" target=_blank>"&rso("webname")&"</a></td><td><img src="&rso("weblogo")&" width=80 height=33 border=0 alt="&rso("webcontent")&"></td><td><a href=?action=edit&id="&rso("id")&">编辑</a> | <a href=?action=del&id="&rso("id")&">删除</a></td></tr>"
rso.movenext
Loop
Else 
content = content & "<tr class=td2><td colspan=5>暂时没有任何友情连接，请添加！</td></tr>"
End If 
content = content & tx_tables.tablesfoot
rso.close 
End Select
Call ClassEnd()
Call DBConnEnd()
response.write content
Call GetBottom()
%>
