<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</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 links",conn,1,3
rs.AddNew
rs("linkname")=trim(request.form("linkname1"))
rs("linkurl")=trim(request.form("linkurl1"))
rs("linkorder")=int(request.form("linkorder1"))
rs.Update
rs.Close
set rs=nothing
response.Redirect "links.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 links where linkid="&linkid,conn,1,3
rs("linkname")=request.form("linkname")
rs("linkurl")=trim(request.form("linkurl"))
rs("linkorder")=int(request.form("linkorder"))
rs.update
rs.close
response.Redirect "links.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 links where linkid="&linkid
response.Redirect "links.asp"

end select

%>
