<!--#include file="conn.asp"-->
<!--#include file="../md5.asp"-->
<%
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
dim action,shjianame
action=request.QueryString("action")
shjianame=request.cookies("bjx")("shjianame")
select case action
'//商家资料
case "myziliao"
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
yewu=trim(request.form("yewu"))
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("useremail")=trim(request.form("useremail"))
rs("name")=trim(request("name"))
rs("name2")=trim(request("name2"))
rs("dz")=trim(request("dz"))
rs("tel")=trim(request("tel"))
rs("shouji")=trim(request("shouji"))
rs("pc")=trim(request("pc"))
if trim(request("oicq"))<>"" then
rs("oicq")=trim(request("oicq"))
end if
rs("yewu")=htmlencode2(yewu)
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('资料修改成功！');window.location.href='admin_right.asp?action=myziliao';</script>"
response.end

'//二级域名
case "url"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("url")=trim(request("url"))
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('域名添加成功！');window.location.href='admin_right.asp?action=url';</script>"
response.end
'//banner修改
case "banner"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("banner")=trim(request("banner"))
rs("url1")=trim(request("url1"))
rs.update
id=rs("shjiaid")
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('banner修改成功！');window.location.href='banner.asp?id="&id&"';</script>"
response.end

'//textbanner修改
case "textbanner"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("textbanner")=trim(request("textbanner"))
rs("texturl")=trim(request("texturl"))
rs.update
id=rs("shjiaid")
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('TextBanner修改成功！');window.location.href='banner.asp?id="&id&"';</script>"
response.end

'//风格
case "fengge"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("fengge")=trim(request("fengge"))
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('风格修改成功');window.location.href='fengge.asp';</script>"
response.end

'//风格
case "zhuangtai"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("zhuangtai")=trim(request("zhuangtai"))
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('状态修改成功');window.location.href='zhuangtai.asp';</script>"
response.end

'//商家LOGO
case "logo"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("logo")=trim(request("logo"))
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('修改成功！');window.location.href='admin_right.asp?action=logo';</script>"
response.end

'//密码修改
case "pass"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
if trim(request("password"))<>"" then
rs("userpassword")=md5(trim(request("password")))
end if
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('密码修改成功！');window.location.href='admin_right.asp?action=pass';</script>"
response.end

'//商家公告
case "gong"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [shjia] where username='"&shjianame&"'",conn,1,3
rs("content")=htmlencode2(trim(request("content")))
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('公告修改成功！');window.location.href='admin_right.asp?action=gong';</script>"
response.end

'//保存新闻
case "savenews"
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
set rs_news=server.CreateObject("adodb.recordset")
rs_news.open "select * from [shjia] where username='"&shjianame&"'",conn,1,1
title=trim(request.form("title"))
content=trim(request.form("content"))
action=trim(request.form("action"))
set rs=server.CreateObject("adodb.recordset")
if action="add" then
rs.open "select * from [news]",conn,1,3
rs.addnew
rs("shjiaid")=rs_news("shjiaid")
rs("title")=title
rs("content")=htmlencode2(content)
rs("addTime")=now()
rs("shjianame")=shjianame
rs.update
rs.close
set rs=nothing
rs_news.close
set rs_news=nothing
response.Write "<script language=javascript>alert('新闻添加成功！');window.location.href='admin_right.asp?action=addnews';</script>"
response.End
elseif action="modify" then
rs.open "select * from news where newsid=" & cstr(request("id")),conn,1,3
rs("title")=title
rs("content")=htmlencode2(content)
rs("addTime")=now()
'rs("shjianame")=shjianame
rs.update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('新闻修改成功！');window.location.href='admin_right.asp?action=glnews';</script>"
response.End
end if

'//保存付款方式
case "fkfs"
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
set rs_news=server.CreateObject("adodb.recordset")
rs_news.open "select * from [shjia] where username='"&shjianame&"'",conn,1,1
content=trim(request.form("content"))
set rs=server.CreateObject("adodb.recordset")
fkong=trim(request.form("fkong"))
if fkong="" then
rs.open "select * from fkfs",conn,1,3
rs.addnew
rs("shjiaid")=rs_news("shjiaid")
rs("content")=htmlencode2(content)
rs.update
rs.close
set rs=nothing
rs_news.close
set rs_news=nothing
response.Write "<script language=javascript>alert('付款方式添加成功！');window.location.href='admin_right.asp?action=fkfs';</script>"
response.End
else
rs.open "select * from fkfs where shjiaid=" & cstr(request("id")),conn,1,3
rs("content")=htmlencode2(content)
rs.update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('付款方式修改成功！');window.location.href='admin_right.asp?action=fkfs';</script>"
response.End
end if

'//保存配送说明
case "ps"
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
set rs_news=server.CreateObject("adodb.recordset")
rs_news.open "select * from [shjia] where username='"&shjianame&"'",conn,1,1
content=trim(request.form("content"))
set rs=server.CreateObject("adodb.recordset")
psong=trim(request.form("psong"))
if psong="" then
rs.open "select * from ps",conn,1,3
rs.addnew
rs("shjiaid")=rs_news("shjiaid")
rs("content")=htmlencode2(content)
rs.update
rs.close
set rs=nothing
rs_news.close
set rs_news=nothing
response.Write "<script language=javascript>alert('配送说明添加成功！');window.location.href='admin_right.asp?action=ps';</script>"
response.End
else
rs.open "select * from ps where shjiaid=" & cstr(request("id")),conn,1,3
rs("content")=htmlencode2(content)
rs.update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('配送说明修改成功！');window.location.href='admin_right.asp?action=ps';</script>"
response.End
end if

'//商家介绍
case "shjintr"
function HTMLEncode2(fString)
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
set rs_news=server.CreateObject("adodb.recordset")
rs_news.open "select * from [shjia] where username='"&shjianame&"'",conn,1,1
shjintr=trim(request.form("shjintr"))
set rs=server.CreateObject("adodb.recordset")
shjintrok=trim(request.form("shjintrok"))
if shjintrok="" then
rs.open "select * from shjintr",conn,1,3
rs.addnew
rs("shjid")=rs_news("shjiaid")
rs("shjintr")=htmlencode2(shjintr)
rs.update
rs.close
set rs=nothing
rs_news.close
set rs_news=nothing
response.Write "<script language=javascript>alert('商家简介添加成功！');window.location.href='admin_right.asp?action=shjintr';</script>"
response.End
else
rs.open "select * from shjintr where shjid=" & cstr(request("id")),conn,1,3
rs("shjintr")=htmlencode2(shjintr)
rs.update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('售后服务说明修改成功！');window.location.href='admin_right.asp?action=shjintr';</script>"
response.End
end if

'//删除留言
case "delfk"
dim id
id=request.QueryString("fkid")
strdel="delete from [shop_shjiafk] where fkid="&id
conn.execute(strdel)
conn.close
response.Write "<script language=javascript>alert('你选择的留言已删除');window.location.href='admin_right.asp?action=fk';</script>"
response.end

'//删除新闻
case "delnews"
dim newsid
newsid=request.QueryString("newsid")
strdel="delete from [news] where newsid="&newsid
conn.execute(strdel)
conn.close
response.Write "<script language=javascript>alert('你选择的新闻已删除');window.location.href='admin_right.asp?action=glnews';</script>"
response.end
end select
%>