<!--#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
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权管理网站设置！');history.go(-1);</script>"
response.End
end if
%>
<%
dim action,id
id=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
if request.form("kfname")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写客服联系名称！');history.go(-1);</script>"
response.End
end if
if request.form("kfsm")="" 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 sdx_customer",conn,1,3
rs.AddNew
rs("kfname")=trim(request.form("kfname"))
rs("kfsm")=trim(request.form("kfsm"))
rs("kftype")=trim(request.form("kftype"))
rs("kfurl")=trim(request.form("kfurl"))
rs("kftop")=trim(request.form("kftop"))
rs("kfon")=trim(request.form("kfon"))
rs.Update
rs.Close
set rs=nothing
response.Write "<script language='javascript'>alert('添加成功！');location.href='admin_kf.asp' ;</script>"
response.End


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 sdx_customer where kfid="&id,conn,1,3
rs("kfname")=trim(request.form("kfname"))
rs("kfsm")=trim(request.form("kfsm"))
rs("kftype")=trim(request.form("kftype"))
rs("kfurl")=trim(request.form("kfurl"))
rs("kftop")=trim(request.form("kftop"))
rs("kfon")=trim(request.form("kfon"))
rs.update
rs.close
set rs=nothing
response.Write "<script language='javascript'>alert('修改成功！');location.href='admin_kf.asp' ;</script>"
response.End
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 sdx_customer where kfid="&id
set rs=nothing
response.Write "<script language='javascript'>alert('删除成功！');location.href='admin_kf.asp' ;</script>"
response.End
response.End
end select

%>