<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<%
style=request.QueryString("style")
if style="modify" then
    id=cint(request("id"))
	SiteInfo=request.Form("SiteInfo")
	SiteInfo=split(SiteInfo,"|")
	Names=SiteInfo(0)
	Url=SiteInfo(1)
	Logo=SiteInfo(2)
    sql="select * from links where ID="&id
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,1,3
	rs("Name")=Names
	rs("Url")=Url
	rs("Logo")=Logo
	rs.update
	rsclose
	response.Write("<script language=javascript>window.location.replace('links.asp');</script>")
	response.End()
elseif style="del" then
    id=request("id")
    conn.execute("delete from links where ID="&id)
	response.Write("<script>window.location.replace('links.asp');</script>")
	response.End()
elseif style="add" then
    sql="select * from links where Name='"&Request.Form("Name")&"'"
    set rs=Server.CreateObject("Adodb.Recordset")
	rs.open sql,conn,1,1
	If not rs.Bof Then 
	   Response.Write("<script language=javascript>alert('已经有此连接。请返回！！！');history.back()</script>")
	   Response.End
	End If      
   conn.execute("insert into links (Name,Url,Logo) values ('"&Request.Form("Name")&"','"&Request.Form("Url")&"','"&request.Form("Logo")&"')")
   Response.Write("<script language=javascript>window.location.replace('links.asp');</script>")
   rsclose
end if
%>
<html>
<head>
<title>顶部连接管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/bbs.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>

<body>
<table width="587" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="23" colspan="3"><div align="center"><strong>友情连接管理</strong></div></td>
  </tr>
  <tr> 
    <td height="18" colspan="3"><div align="center"> 
        <table width="100%" height="106%" border="0" align="left" cellpadding="0" cellspacing="0">
          <%sql="select * from links order by id asc"
		set rs=conn.execute(sql)
		i=1
		do while not rs.eof%>
          <form action="?style=modify" method="post" name="form<%=i%>">
            <tr> 
              <input name="id" type="hidden" value="<%=rs("ID")%>">
              <td width="94" height="45"><div align="center"><img src="<%=rs("Logo")%>" width="88" height="31" border="0"></div></td>
              <td height="45"><input name="SiteInfo" type="text" id="SiteInfo" size="55" value="<%=rs("Name")%>|<%=rs("Url")%>|<%=rs("Logo")%>" style="font-family:宋体; font-size:9pt; color:#000000; width:400px; height:19px; border:1px solid #000000; background-color:#F0F0F0;"></td>
              <td width="50" height="45"><div align="center"> 
                  <input type="submit" name="Submit3" value="修改" style="font-family:宋体; font-size:9pt; color:#000000; width:30px; height:19px; border:1px solid #000000; background-color:#F0F0F0;">
              </div></td>
              <td width="40" height="45"><div align="center"><a href="?id=<%=rs("ID")%>&style=del" class="black">删除</a></div></td>
            </tr>
          </form>
          <%rs.movenext
		  i=i+1
		loop%>
        </table>
      </div></td>
  </tr>
  <form action="?style=add" method="post" name="formadd">
    <tr>
      <td height="24">&nbsp;</td>
      <td colspan="2"><span class="style1">**</span>修改时请注意：次序为站点名称、网址、Logo地址</td>
    </tr>
    <tr> 
      <td width="94" height="24"><div align="center"></div></td>
      <td width="98">站点名称</td>
      <td width="395"><input name="Name" type="text" id="Name" size="45" style="font-family:宋体; font-size:9pt; color:#000000; width:350px; height:19px; border:1px solid #000000; background-color:#F0F0F0;"></td>
    </tr>
    <tr>
      <td height="28">&nbsp;</td>
      <td height="28">Logo地址</td>
      <td><input name="Logo" type="text" id="Logo" size="45" style="font-family:宋体; font-size:9pt; color:#000000; width:350px; height:19px; border:1px solid #000000; background-color:#F0F0F0;"></td>
    </tr>
    <tr> 
      <td height="28"><div align="center"></div></td>
      <td height="28">连接地址</td>
      <td><input name="Url" type="text" id="Url2" size="45" style="font-family:宋体; font-size:9pt; color:#000000; width:350px; height:19px; border:1px solid #000000; background-color:#F0F0F0;"></td>
    </tr>
    <tr> 
      <td height="20" colspan="2"><div align="center"></div></td>
      <td><input type="submit" name="Submit" value="添加" style="font-family:宋体; font-size:9pt; color:#000000; width:30px; height:19px; border:1px solid #000000; background-color:#F0F0F0;">
      <input type="reset" name="Submit2" value="取消" style="font-family:宋体; font-size:9pt; color:#000000; width:30px; height:19px; border:1px solid #000000; background-color:#F0F0F0;"> 
      </td>
    </tr>
  </form>
</table>
</body>
</html>
<%ConnClose%>