<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<%
If Request.QueryString("action")="pass" Then
Dim cid
cid = Request.QueryString("id")
Conn.ExeCute("Update [Link] Set Show=1 Where id="&cid&"")
JaSys("管理员" & session("ManagerUser") & "<font color=red>通过ID为"&cid&"的连接审核</font>")
 Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('通过审核成功!');" & Chr(13)
		Response.write "window.document.location.href='Link.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
    Response.End
End If
If Request.QueryString("action")="close" Then
cid = Request.QueryString("id")
Conn.ExeCute("Update [Link] Set Show=0 Where id="&cid&"")
JaSys("管理员" & session("ManagerUser") & "<font color=red>取消ID为"&cid&"的连接审核</font>")
 Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('取消审核成功!');" & Chr(13)
		Response.write "window.document.location.href='Link.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
    Response.End
End If
If Request.QueryString("action")="del" then
id = Trim(Request("id"))
Set dd=Conn.Execute("DELETE FROM [Link] Where ID="&Clng(id))
JaSys("管理员" & session("ManagerUser") & "<font color=red>删除友情连接ID"&ID&"</font>成功")
Response.Redirect "Link.asp"
End if

If Request.QueryString("action")="add" then
Call AddLink
Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('添加成功!');" & Chr(13)
		Response.write "window.document.location.href='Link.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
Response.End
End if
%>
<html>
<head>
<titel></titel>
<LINK href="admin/admin.css" type=text/css rel=stylesheet>
</head>
<body>
<table width="100%" height="60%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"><br><br>
      <form name="form2" method="post" action="Link.asp?action=add">
        <table width="550" border="0" cellspacing="0" cellpadding="2" class=tableBorder>
          <tr> 
            <td height="25" colspan="2" background="admin/admin_bg_1.gif"> <div align="center"><strong><font color="#FFFFFF">友情链接管理</font></strong></div></td>
          </tr>
          <tr> 
            <td width="121"> 网站名称<br> </td>
            <td width="427"><input type="text" name="name" size="35" maxlength="40"></td>
          </tr>
          <tr> 
            <td>网站说明</td>
            <td><input type="text" name="note" size="50" maxlength="120"></td>
          </tr>
          <tr> 
            <td>连接地址</td>
            <td><input type="text" name="link" size="40" maxlength="50" value="http://"></td>
          </tr>
          <tr> 
            <td colspan="2"> <div align="center"> 
                <input name="add" type="submit" id="add" value="提交">
                <input type="reset" name="Submit2" value="重置">
              </div></td>
          </tr>
        </table>
      </form>
      <p>&nbsp;</p>
      <%
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open "SELECT * FROM [Link] Order BY ID Desc",Conn,1,1
%>
      <table width="700" border="0" cellpadding="2" cellspacing="0" class=tableBorder>
        <tr> 
          <td width="22%" height="25" background="admin/admin_bg_1.gif"> <div align="center">网站名称</div></td>
          <td width="26%" background="admin/admin_bg_1.gif"> <div align="center">网站说明</div></td>
          <td width="14%" background="admin/admin_bg_1.gif"> <div align="center">加入时间</div></td>
          <td width="20%" background="admin/admin_bg_1.gif"> <div align="center">审核情况</div></td>
          <td background="admin/admin_bg_1.gif"> <div align="center">操作</div>
            <div align="center"></div></td>
        </tr>
        <%Do While not Rs.Eof %>
        <tr> 
          <td> <div align="center"><a href="<%=Rs("Link")%>" target="_blank"><%=Rs("Name")%></a></div></td>
          <td> <div align="center"><%=Rs("Note")%></div></td>
          <td> <div align="center"><%=FormatDateTime(rs("Time"),2) %></div></td>
          <td> <div align="center"><%If Cint(Rs("Show"))=1 Then Response.Write "已审核" Else Response.Write "未审核" End if%></div></td> 
          <td> <div align="center"><a href="Link_Update.asp?action=update&id=<%=Rs("id")%>">修改</a>| 
               <a href="Link.asp?id=<%=Rs("id")%>&action=del">删除</a>|&nbsp;<%If int(Rs("Show"))=1 Then%><a href="?action=close&id=<%=rs("ID")%>">取消审核</a><%Else%><a href="?action=pass&id=<%=rs("ID")%>">通过审核</a><%End If%></div></td>
        </tr>
        <%Rs.MoveNext 
loop 
%>
      </table>
<%
Rs.Close
Set Rs = Nothing
call CloseConn() 
%>
    </td>
  </tr>
</table>
</body>
</html>
<%
Sub AddLink
note=Trim(request.form("note"))
link=Trim(request.form("link"))
name=Trim(request.form("name"))

If name=""  or note="http://" Then
Response.Write("<script language=""JavaScript"">alert(""错误：您没输入网站名称，请返回检查！！"");history.go(-1);</script>")
response.end
end if

If note=""  or note="http://" Then
Response.Write("<script language=""JavaScript"">alert(""错误：您没输入图标连接，请返回检查！！"");history.go(-1);</script>")
response.end
end if

If link="" or link="http://" Then
Response.Write("<script language=""JavaScript"">alert(""错误：您没有输入超连接，请返回检查！！"");history.go(-1);</script>")
response.end
end if

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Link "
rs.open sql,conn,1,3
rs.addnew
rs("Name")=name
rs("Note")=note
rs("Link")=link
rs("show")=1
rs.update
rs.Close
Set rs=Nothing
JaSys("管理员" & session("ManagerUser") & "<font color=red>添加友情连接"&name&"</font>成功")
End Sub
%>