<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
else
if request.cookies("timesshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
end if
end if


dim action,linkid
linkid=SafeRequest("id",1)
action=FormatSQL(SafeRequest("action",0))
select case action
case "add"
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权添加图片友情连接！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from imglinks",conn,1,3
rs.AddNew
rs("linkname")=trim(request.form("linkname1"))
rs("linkurl")=trim(request.form("linkurl1"))
rs("linkorder")=int(request.form("linkorder1"))
rs("linkimg")=trim(request.form("linkimg1"))
rs.Update
rs.Close
set rs=nothing
response.Redirect "piclinks.asp"
case "edit"
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权编辑图片友情连接！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from imglinks where linkid="&linkid,conn,1,3
rs("linkname")=request.form("linkname")
rs("linkurl")=trim(request.form("linkurl"))
rs("linkorder")=int(request.form("linkorder"))
rs("linkimg")=trim(request.form("linkimg"))
rs.update
rs.close
response.Redirect "piclinks.asp"
set rs=nothing
case "del"
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权删除图片友情连接！');history.go(-1);</script>"
response.End
end if
conn.execute "delete from imglinks where linkid="&linkid
response.Redirect "piclinks.asp"

end select

%>
<title>图片连接</title>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699cc">
  <tr> 
    <td align="center"><font color="#FFFFFF">管理合作伙伴</font></td>
  </tr>
  <tr> 
    <td height="99" valign="top" bgcolor="#FFFFFF"><br> 
      <%set rs=server.CreateObject("adodb.recordset")
		rs.open "select * from imglinks order by linkorder",conn,1,1
		dim i
		i=rs.recordcount%>
      <table width="90%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
        <tr height="20" bgcolor="#FFFFFF" align="center"> 
          <td width="18%">网站名称</td>
          <td width="30%">网站地址</td>
          <td width="30%">图片地址</td>
          <td width="7%" >排 序</td>
          <td width="15%">操 作</td>
        </tr>
        <%if rs.eof and rs.bof then
		  response.write "还没有数据，请添加！"
		  else
		  do while not rs.eof%>
        <tr bgcolor="#FFFFFF" align="center"> 
          <form name="form1" method="post" action="piclinks.asp?action=edit&id=<%=rs("linkid")%>">
            <td><input name="linkname" type="text" id="linkname" value="<%=trim(rs("linkname"))%>" size="20"></td>
            <td><input name="linkurl" type="text" id="linkurl" value="<%=trim(rs("linkurl"))%>" size="32"></td>
            <td><INPUT NAME="linkimg" TYPE="text" ID="linkimg" VALUE="<%=trim(rs("linkimg"))%>" SIZE="32"></td>
            <td><input name="linkorder" type="text" id="linkorder" value=<%=rs("linkorder")%> size="3"></td>
            <td><input type="submit" name="Submit" value="修 改">
                &nbsp;<a href=piclinks.asp?action=del&id=<%=rs("linkid")%>><font color="#FF6600">删除</font></a> 
              </td>
          </form>
        </tr>
        <%rs.movenext
		  loop
		  end if
		  rs.close
		  set rs=nothing%>
      </table></td>
  </tr>
</table>
<br>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699cc">
  <tr> 
    <td align="center"><font color="#FFFFFF">添加合作伙伴</font></td>
  </tr>
  <tr> 
    <form name="form2" method="post" action="piclinks.asp?action=add">
      <td height="98" bgcolor="#FFFFFF"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
          <tr height="20" bgcolor="#FFFFFF" align="center"> 
            <td WIDTH="18%">网站名称</td>
            <td WIDTH="30%">网站地址</td>
            <td WIDTH="30%">图片地址</td>
            <td WIDTH="10%">排 序</td>
            <td WIDTH="12%">操 作</td>
          </tr>
          <tr height="20" bgcolor="#FFFFFF" align="center"> 
            <td><input name="linkname1" type="text" id="linkname12" size="20"></td>
            <td><input name="linkurl1" type="text" id="linkurl12" size="32"></td>
            <td><INPUT NAME="linkimg1" TYPE="text" ID="linkimg12" SIZE="32"></td>
            <td><input name="linkorder1" type="text" id="linkorder12" value=<%=i+1%> size="3"></td>
            <td><input type="submit" name="Submit2" value="添 加"></td>
          </tr>
        </table></td>
    </form>
  </tr>
</table>
<br>
<!--#include file="footer.asp"-->