<%
'商易仿淘宝4.0(多用户)
'ACCESS版演示网站：http://www.ftaobao.com(商易仿淘宝商城)
'SQL版演示网站：http://sql.ftaobao.com
'电话：0571-56907100
'QQ：1147100
%>
<%qx=3%>
<!--#include file="check.asp"-->
<!--#include file="../include/conn.asp"-->
<%

linkname=request("linkname")
linkurl=request("linkurl")
linksm=request("linksm")
key=request("key")

if request("action")="del" then
conn.execute("delete from SMT_links where SMT_id=" & request("id"))
response.redirect "links.asp?action=reh"

elseif request("action")="editsave" then
if linkname="" or linkurl="" or linksm="" or key="" then
response.write"<script>alert('友情连接资料不能为空！！！');history.go(-1)</script>"
response.end
end if
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_links where SMT_id="&request("id")
rs.open sql,conn,1,3
rs("SMT_linkname")=linkname
rs("SMT_linkurl")=linkurl
rs("SMT_linksm")=linksm
rs.update
rs.close
set rs=nothing
response.redirect "links.asp?action=reh"

elseif request("action")="save" then
if linkname="" or linkurl="" or linksm="" or key="" then
response.write"<script>alert('友情连接资料不能为空！！！');history.go(-1)</script>"
response.end
end if
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_links"
rs.open sql,conn,1,3
rs.addnew
rs("SMT_linkname")=linkname
rs("SMT_linkurl")=linkurl
rs("SMT_linksm")=linksm
rs("SMT_key")=key
rs.update
rs.close
set rs=nothing
'商易仿淘宝4.0.1演示地址
'http://www.ftaobao.com
response.redirect "links.asp?action=reh"
elseif request("action")="reh" then
response.write "<meta http-equiv='refresh' content='0;URL=links.asp'>"
end if%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../include/css.css" rel="stylesheet" type="text/css">
<br>
<table width="97%" border="0" cellspacing="0" cellpadding="0" align=center>
  <tr>
    <td width=50%>
<table width="98%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<form name="addform" action="links.asp?action=save" method="post">
<input name="key" type="hidden" value="0">
<tr><td height="25" colspan=2 bgcolor=#efefef>&nbsp; <strong>文字连接</strong></td></tr>
<tr><td width="80" height="25" align="right">网站名称&nbsp;</td>
<td>&nbsp;<input name="linkname" type="text" size="20" value="http://"></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 type="submit" name="Submit" value=" 添 加 "></td></tr>
</form>
</table>
	</td>
    <td width=50%>
<table width="98%" border="1" align="right" cellpadding="0" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<form name="form" action="links.asp?action=save" method="post">
<input name="key" type="hidden" value="1">
<tr><td height="25" colspan=2 bgcolor=#efefef>&nbsp; <strong>图片连接</strong></td></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 type="submit" name="Submit" value=" 添 加 "></td></tr>
</form>
</table>
	</td>
  </tr>
</table>

<br>
<table width="97%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<tr align=center>
<%set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_links where SMT_key=0 and SMT_key1=1 order by SMT_id desc"
rs.open sql,conn,1,1
n=0
do while not rs.eof
n=n+1%>
<td height="25"><a href=<%=rs("SMT_linkurl")%> title=<%=rs("SMT_linksm")%> target="_blank"><%=rs("SMT_linkname")%></a> <a href=links.asp?action=edit&id=<%=rs("SMT_id")%>&key=0 class=red>改</a> <a href=links.asp?action=del&id=<%=rs("SMT_id")%> class=red>删</a></td>
<%if n mod 5=0 then response.write "</tr><tr align=center>"
rs.movenext
loop
rs.close
set rs=nothing%>
</tr>
<tr align=center>
<%set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_links where SMT_key=1 and SMT_key1=1 order by SMT_id desc"
rs.open sql,conn,1,1
n=0
do while not rs.eof
n=n+1%>
<td height="40">
<table width="100" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td align="center"><p style="line-height:130%"><a href=<%=rs("SMT_linkurl")%> title=<%=rs("SMT_linksm")%> target="_blank"><img align="left" src="<%=rs("SMT_linkname")%>" width=88 height=31 border=0></a> <a href=links.asp?action=edit&id=<%=rs("SMT_id")%>&key=1 class=red>改</a> <a href=links.asp?action=del&id=<%=rs("SMT_id")%> class=red>删</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>
<br>
<%if request("action")="edit" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_links where SMT_id="&request("id")
rs.open sql,conn,1,1%>
<table width="97%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
<form name="form" action="links.asp" method="post">
<input name="id" type="hidden" value="<%=request("id")%>">
<input name="action" type="hidden" value="editsave">
<%if request("key")=0 then%>
<input name="key" type="hidden" value="0">
<tr><td height="25" colspan=2 bgcolor=#efefef>&nbsp; <strong>文字连接</strong></td></tr>
<tr><td width="200" height="25" align="right">网站名称&nbsp;</td>
<td>&nbsp;<input name="linkname" type="text" size="20" value="<%=rs("SMT_linkname")%>"></td></tr>
<%else%>
<input name="key" type="hidden" value="1">
<tr><td height="25" colspan=2 bgcolor=#efefef>&nbsp; <strong>图片连接</strong></td></tr>
<tr><td width="200" height="25" align="right">图片地址&nbsp;</td>
<td>&nbsp;<input name="linkname" type="text" size="30" value="<%=rs("SMT_linkname")%>"> 尺寸：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("SMT_linkurl")%>"></td></tr>
<tr><td height="25" align="right">网站说明&nbsp;</td>
<td>&nbsp;<input name="linksm" type="text" size="40" value="<%=rs("SMT_linksm")%>"></td></tr>
<tr><td height="25" align="center" colspan="2"><input type="submit" name="Submit" value=" 修 改 "></td></tr>
</form>
</table>
<%rs.close
set rs=nothing
end if%>








