<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp"-->
<%
If Not FRAdminLevel(108) Then
	Call ErrorMsg()
End If
Response.Expires = 0 
Response.CacheControl = "no-cache" 
Response.ExpiresAbsolute = Now() - 1 
Dim Action
linkname=request("linkname")
linkurl=request("linkurl")
linksm=request("linksm")
key=request("key")
id=request("id")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>友情连接</title>
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <tr>
    <th height="25">友情链接管理</th>
  </tr>
  <tr>
    <td height=25 style="border-bottom:1px #cccccc solid"><b>　<span class="style1">管理选项：</span></b><a href="admin_links.asp">管理首页</a> | <a href="admin_links.asp?Action=Add">添加链接</a> | <a href="admin_links.asp?Action=Cakmain">未审核链接</a>&nbsp;|&nbsp;[<a href="javascript:location.reload()">刷新页面</a>]</td>
  </tr>
</table>
<%
Action=trim(Request("Action"))
Select Case Action
	Case "Add"
		Call ShowData()
	Case "Modify"
		Call ModifyData()
	Case "SaveData"
		Call SaveData()
	Case "Del"
		Call Del()
	Case "Cakmain"
		Call main()
	Case "Cak"
		Call Cak()
	Case "UnCak"
		Call UnCak()
	Case "CakTj"
		Call CakTj()
	Case "UnCakTj"
		Call UnCakTj()
	Case Else
		Call main()
End Select

if FoundErr=True then
	call Show_Err()
end if

Conn.Close
Set Conn=Nothing
%>
<!--#include file="../inc/copy.asp" -->
<!--</body>
</html>-->
<%Sub ShowData()%>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
<form name="addform" action="admin_links.asp?action=SaveData" method="post">
<input name="key" type="hidden" value="0">
<tr>
    <th class="tableHeaderText" colspan=2 height=25>文字链接</th>
</tr>
<tr><td width="80" height="25" align="right">网站名称&nbsp;</td>
<td>&nbsp;
  <input name="linkname" type="text" size="20"></td></tr>
<tr> <td height="25" align="right">链接地址&nbsp;</td>
<td>&nbsp;
  <input name="linkurl" type="text" size="40" value="http://"></td></tr>
<tr><td height="25" align="right">网站说明&nbsp;</td>
<td>&nbsp;
  <input name="linksm" type="text" size="40"></td></tr>
<tr><td height="25" align="center" colspan="2"><input name="Submit" type="submit" class="inputs" value=" 添 加 "></td></tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder">
  <form name="form" action="admin_links.asp?action=SaveData" method="post">
    <input name="key" type="hidden" value="1">
    <tr>
      <th class="tableHeaderText" colspan=2 height=25>图片链接</th>
    </tr>
    <tr>
      <td width="80" height="25" align="right">图片地址&nbsp;</td>
      <td>&nbsp;
          <input name="linkname" type="text" size="30" value="http://">
      尺寸：88*31</td>
    </tr>
    <tr>
      <td height="25" align="right">链接地址&nbsp;</td>
      <td>&nbsp;
      <input name="linkurl" type="text" size="40" value="http://"></td>
    </tr>
    <tr>
      <td height="25" align="right">网站说明&nbsp;</td>
      <td>&nbsp;
      <input name="linksm" type="text" size="40"></td>
    </tr>
    <tr>
      <td height="25" align="center" colspan="2"><input name="Submit" type="submit" class="inputs" value=" 添 加 "></td>
    </tr>
  </form>
</table>
<%end sub%>
<%Sub Main()%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder">
<tr><th colspan="5">文字链接</th></tr>
<tr align=center>
<%set rs=Server.CreateObject("Adodb.Recordset")
if Action="Cakmain" then
sql="select * from JOB_links where link_key=0 and link_key1=0 order by id desc"
else
sql="select * from JOB_links where link_key=0 and link_key1=1 order by id desc"
end if
rs.open sql,conn,1,1
n=0
do while not rs.eof
n=n+1%>
<td height="25"><a href=<%=rs("link_url")%> title=<%=rs("link_sm")%> target="_blank" class="amrow"><%=rs("link_name")%></a><br><%if Action<>"Cakmain" then%><a href=admin_links.asp?action=Modify&id=<%=rs("id")%>&key=0 class=red>修改</a> <%end if%> <%if rs("link_tj")="1" then%><a href=admin_links.asp?action=UnCakTj&id=<%=rs("id")%> class=red>撤销</a> <%else%><a href=admin_links.asp?action=CakTj&id=<%=rs("id")%> class=red>推荐</a> <%end if%> <%if Action="Cakmain" then%><a href=admin_links.asp?action=Cak&id=<%=rs("id")%> class=red>审核</a> <%else%><a href=admin_links.asp?action=UnCak&id=<%=rs("id")%> class=red>屏蔽</a> <%end if%> <a href=admin_links.asp?action=Del&id=<%=rs("id")%> class=amrow>删除</a></td>
<%if n mod 5=0 then response.write "</tr><tr align=center>"
rs.movenext
loop
rs.close
set rs=nothing%>
</tr>
<tr><th colspan="5">图片链接</th></tr>
<tr align=center class="amrow">
<%set rs=Server.CreateObject("Adodb.Recordset")
if Action="Cakmain" then
sql="select * from JOB_links where link_key=1 and link_key1=0 order by id desc"
else
sql="select * from JOB_links where link_key=1 and link_key1=1 order by id desc"
end if
rs.open sql,conn,1,1
n=0
do while not rs.eof
n=n+1%>
<td height="40">
<table width="140" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td align="center" class="amrow"><p style="line-height:130%"><a href=<%=rs("link_url")%> title=<%=rs("link_sm")%> target="_blank"><img src="<%=rs("link_name")%>" width=88 height=31 border=0></a><br><%if Action<>"Cakmain" then%><a href=admin_links.asp?action=Modify&id=<%=rs("id")%>&key=1 class=red>修改</a> <%end if%> <%if rs("link_tj")="1" then%><a href=admin_links.asp?action=UnCakTj&id=<%=rs("id")%> class=red>撤销</a> <%else%><a href=admin_links.asp?action=CakTj&id=<%=rs("id")%> class=red>推荐</a> <%end if%> <%if Action="Cakmain" then%><a href=admin_links.asp?action=Cak&id=<%=rs("id")%> class=red>审核</a> <%else%><a href=admin_links.asp?action=UnCak&id=<%=rs("id")%> class=red>屏蔽</a> <%end if%> <a href=admin_links.asp?action=Del&id=<%=rs("id")%> class=amrow>删除</a></td>
  </tr>
</table>
</td>
<%if n mod 5=0 then response.write "</tr><tr align=center>"
rs.movenext
loop
rs.close
set rs=nothing%>
</tr>
</table>
<%end sub%>
<%Sub ModifyData()
if id="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>参数错误！</li>"
	exit sub
else
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from JOB_links where id="&id
rs.open sql,conn,1,1
if not rs.eof then%>
<table width="97%" border="0" align="center" cellpadding="3" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" class="tableBorder">
<form name="form" action="admin_links.asp" method="post">
<input name="id" type="hidden" value="<%=request("id")%>">
<input name="Action" type="hidden" value="SaveData">
<%if request("key")=0 then%>
<input name="key" type="hidden" value="0">
<tr>
    <th class="tableHeaderText" colspan=2 height=25>文字链接</th>
</tr>
<tr><td width="200" height="25" align="right">网站名称&nbsp;</td>
<td>&nbsp;
  <input name="linkname" type="text" size="20" value="<%=rs("link_name")%>"></td></tr>
<%else%>
<input name="key" type="hidden" value="1">
<tr>
    <th class="tableHeaderText" colspan=2 height=25>图片<span style="border-bottom:1px #cccccc solid">链</span>接</th>
</tr>
<tr><td width="200" height="25" align="right">图片地址&nbsp;</td>
<td>&nbsp;
  <input name="linkname" type="text" size="30" value="<%=rs("link_name")%>"> 尺寸：88*31</td></tr>
<%end if%>
<tr> <td height="25" align="right">链接地址&nbsp;</td>
<td>&nbsp;
  <input name="linkurl" type="text" size="40" value="<%=rs("link_url")%>"></td></tr>
<tr><td height="25" align="right">网站说明&nbsp;</td>
<td>&nbsp;
  <input name="linksm" type="text" size="40" value="<%=rs("link_sm")%>"></td></tr>
<tr><td height="25" align="center" colspan="2"><input name="Submit" type="submit" class="inputs" value=" 修 改 "></td></tr>
</form>
</table>
<%
end if
end if
End Sub%>
<%
sub SaveData()
if linkname="" or linkurl="" or linksm="" or key="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>信息填写不完整，返回重新输入！</li>"
	exit sub
else
set rs=Server.CreateObject("Adodb.Recordset")
	if id<>"" then
	sql="select * from JOB_links where id="&id
	rs.open sql,conn,1,3
	else
	sql="select * from JOB_links"
	rs.open sql,conn,1,3
	rs.addnew
	rs("link_key")=key
	rs("link_key1")=1
	end if
rs("link_name")=linkname
rs("link_url")=linkurl
rs("link_sm")=linksm
rs.update
rs.close
set rs=nothing
response.redirect "admin_links.asp"
Response.end()
end if
end sub%>
<%Sub Cak()
if id<>"" then
conn.execute("update JOB_links set link_key1=1 where id="&id)
response.redirect "admin_links.asp?Action=Cakmain"
Response.end()
end if
End Sub
Sub UnCak()
if id<>"" then
conn.execute("update JOB_links set link_key1=0 where id="&id)
response.redirect "admin_links.asp"
Response.end()
end if
End Sub
Sub CakTj()
if id<>"" then
conn.execute("update JOB_links set link_tj=1 where id="&id)
response.redirect "admin_links.asp"
Response.end()
end if
End Sub
Sub UnCakTj()
if id<>"" then
conn.execute("update JOB_links set link_tj=0 where id="&id)
response.redirect "admin_links.asp"
Response.end()
end if
End Sub%>
<%Sub Del()
if id<>"" then
conn.execute("delete from JOB_links where id="&id)
response.redirect "admin_links.asp"
Response.end()
end if
End Sub%>