<!--#include file = "tuzh_pri.asp"-->
<!--#include file="../setup.asp" -->
<!--#include file="../connadmin.asp"-->

<HTML>
<HEAD>
<TITLE>系统用户管理——<%=site_name%></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../img/css.css" type="text/css">
<script language="JavaScript">
function reok(){
if (confirm("你真的要恢复系统默认设置吗？")){
	document.location.href="admin_sysset.asp?action=reok";
	}
}
</script>
<script language="javascript" src="../Images/Disp.js"></script>
<style type=text/css>
body  {
SCROLLBAR-FACE-COLOR: #9CC5D7;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; 
SCROLLBAR-SHADOW-COLOR: #006699; 
SCROLLBAR-3DLIGHT-COLOR: #006699; 
SCROLLBAR-ARROW-COLOR: #330000; 
SCROLLBAR-TRACK-COLOR: #E2F3F1; 
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;}
</style></HEAD>

<BODY>
<table class="border" width="95%" border="0" align="center" cellpadding="1" cellspacing="0">
  <tr> 
    <td align="center" valign="top" class="bg_low"> 
      <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td align="center" valign="middle" class="bgtop"><font class="bgtop_title">管理友情链接</font> 
          </td>
        </tr>
      </table>
      <table width="100%" border="1"  align=center cellpadding="3" cellspacing="0" bordercolor="#ABCEDD">
        <form action="links.asp?add=ok" method="post" name="friendly_link_img_add" id="friendly_link_img_add">
          <tr bgcolor="#0099CC"> 
            <td colspan=2> <div align="left"><font color="#FFFFFF"><b><font color="#000000">◎ 
                添加友情链接</font></b></font></div></td>
          </tr>
          <tr> 
            <td width="27%"> 网站名称： </td>
            <td width="73%"><span class="td">
              <input name="title" type="text" class="input" size="30" />
            </span></td>
          </tr>
          <tr>
            <td align=left>网站LOGO：</td>
            <td align=left><span class="td">
              <input name="logo" type="text" id="logo" size="40">
            </span></td>
          </tr>
          <tr>
            <td align=left>网站地址：</td>
            <td align=left><span class="td">
            <input name="url" type="text" id="url" size="40">
            </span></td>
          </tr>
          <tr> 
            <td align=left width="27%">排序：</td>
            <td align=left width="73%"><span class="td">
              <input name="order_id" type="text" class="input" size="10"/>
            </span></td>
          </tr>
          
          <tr> 
            <td align=left colspan="2"> <div align="center"> 
                <input type="submit" name="Submit" value="  设 置  " class="button2">
                <input type="button" name="Submit2" value="  恢复  " OnClick="reok()" class="button2">
            </div></td>
          </tr>
        </form>
    </table>
      <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#ABCEDD" class="table">
        <%
Set rs = server.CreateObject("adodb.recordset")
exec = "select * from friendly_link_img order by order_id asc"
rs.Open exec, conn, 1, 1
If rs.EOF Then
    response.Write "&nbsp;暂无图片友情链接！"
Else
    rs.PageSize = 15 '每页记录条数
    iCount = rs.RecordCount '记录总数
    iPageSize = rs.PageSize
    maxpage = rs.PageCount
    page = request("page")
    If Not IsNumeric(page) Or page = "" Then
        page = 1
    Else
        page = CInt(page)
    End If
    If page<1 Then
        page = 1
    ElseIf page>maxpage Then
        page = maxpage
    End If
    rs.AbsolutePage = Page
    If page = maxpage Then
        x = iCount - (maxpage -1) * iPageSize
    Else
        x = iPageSize
    End If
%>
        <tr>
          <th width="40" height="19" bgcolor="#0099CC" class="td2">排序</th>
          <th width="100" bgcolor="#0099CC" class="td2">网站loog</th>
          <th width="180" bgcolor="#0099CC" class="td2">网站名称</th>
          <th bgcolor="#0099CC" class="td2">链接地址</th>
          <th width="120" bgcolor="#0099CC" class="td2">修改操作</th>
        </tr>
        <%For i=1 To x%>
        <form method="post" name="friendly_link" id="friendly_link">
          <tr>
            <td bgcolor="#9CC5D7" class="td"><%=rs("order_id")%></td>
            <td bgcolor="#9CC5D7" class="td"><img src="../../<%=rs("logo")%>" width="80" height="30" alt="<%=rs("title")%>" /></td>
            <td bgcolor="#9CC5D7" class="td"><%=rs("title")%></td>
            <td bgcolor="#9CC5D7" class="td"><%=rs("url")%></td>
            <td bgcolor="#9CC5D7" class="td"><input name="update" type="button" class="button" onClick="window.location.href='friendly_link_update_img.asp?id=<%=rs("id")%>' " value="修改"/>
                <input name="delete" type="button" class="button" onClick="javascript:if(confirm('确定要删除吗？删除后不可恢复!')){window.location.href='friendly_link_view.asp?act=del_img&amp;id=<%=rs("id")%>';}else{history.go(0);}" value="删除" /></td>
          </tr>
        </form>
        <%rs.movenext
Next
%>
        <%
End If
%>
      </table>
    <%
''''''''设置上一页,下一页功能///////////////////////////////////////////////////////////////////////////////////////
    response.Write "当前"&curpage&"页/总共"&rs.pagecount&"页"
     if curpage = 1 then 
		response.write "首页 前页 "
	else
		response.write "<a class='xiahua' href='links.asp?page=1'>首页</a> <a class='xiahua' href='links.asp?page=" & cstr(curpage-1) & "'>前页</a> "
	end if
	if  curpage = rs.pagecount then
		response.write "后页 末页"
	else
		response.write "<a class='xiahua' href='links.asp?page=" & cstr(curpage+1) & "'>后页</a> <a class='xiahua' href='links.asp?page=" & cstr(rs.pagecount) & "'>末页</a>"
	end if
	response.write "(总共"&rs.recordcount&"条新闻)"
''''''''设置上一页,下一页功能////////////////////////////////////////////////////////////////////////////////////

rs.close
set rs=nothing
%></td>
  </tr>
</table>
<br>
</BODY>
</HTML>
<%
If Request.QueryString("add_text") = "ok" Then
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from friendly_link_text"
    rs.Open sql, conn, 1, 3
    title = request.Form("title")
    url = request.Form("url")
    order_id = request.Form("order_id")
    If title = "" Then
        response.Write("<script language=javascript>alert('网站名称不能为空！');history.go(-1)</script>")
        response.End
    End If
    If url = "" Then
        response.Write("<script language=javascript>alert('链接地址不能为空！');history.go(-1)</script>")
        response.End
    End If
    If order_id = "" Then
        response.Write("<script language=javascript>alert('排序数字不能为空！');history.go(-1)</script>")
        response.End
    End If
    If Not IsNumeric(request("order_id")) Then
        response.Write("<script language=javascript>alert('排序字符必须为数字！');history.go(-1)</script>")
        response.End
    End If
    rs.addnew
    rs("title") = title
    rs("url") = url
    rs("order_id") = order_id
    rs.update
    rs.Close
    Set rs = Nothing
    conn.Close
    Set rs = Nothing
%>
<%
Response.Write "<script language=javascript>alert('添加成功');window.location.href='friendly_link.asp';</script>"
End If
%>
<%
If Request.QueryString("add_img") = "ok" Then
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from friendly_link_img"
    rs.Open sql, conn, 1, 3
    title = request.Form("title")
    url = request.Form("url")
    logo = request.Form("BigPic")
    order_id = request.Form("order_id")
    If title = "" Then
        response.Write("<script language=javascript>alert('网站名称不能为空!');history.go(-1)</script>")
        response.End
    End If
    If url = "" Then
        response.Write("<script language=javascript>alert('链接地址不能为空!');history.go(-1)</script>")
        response.End
    End If
    If logo = "" Then
        response.Write("<script language=javascript>alert('网站logo不能为空!');history.go(-1)</script>")
        response.End
    End If
    If order_id = "" Then
        response.Write("<script language=javascript>alert('排序数字不能为空!');history.go(-1)</script>")
        response.End
    End If
    If Not IsNumeric(request("order_id")) Then
        response.Write("<script language=javascript>alert('排序字符必须为数字!');history.go(-1)</script>")
        response.End
    End If
    rs.addnew
    rs("title") = title
    rs("url") = url
    rs("logo") = logo
    rs("order_id") = order_id
    rs.update
    rs.Close
    Set rs = Nothing
    conn.Close
    Set rs = Nothing
%>
<%
Response.Write "<script language=javascript>alert('添加成功');window.location.href='friendly_link.asp';</script>"
End If
%>

<%
If request("act") = "del_text" Then
    Set rs = server.CreateObject("adodb.recordset")
    id = Request.QueryString("id")
    sql = "select * from friendly_link_text where id="&id
    rs.Open sql, conn, 2, 3
    rs.Delete
    rs.update
    Response.Write "<script>alert('刪除成功！');window.location.href='friendly_link_view.asp';</script>"
End If
%>
<%
If request("act") = "del_img" Then
    Set rs = server.CreateObject("adodb.recordset")
    id = Request.QueryString("id")
    sql = "select * from friendly_link_img where id="&id
    rs.Open sql, conn, 2, 3
    rs.Delete
    rs.update
    Response.Write "<script>alert('刪除成功！');window.location.href='friendly_link_view.asp';</script>"
End If
%>