<!--#include file="conn.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
end if
if request("shopname")="" or request("shichangjia")="" or request("huiyuanjia")="" or request("vipjia")="" then
response.Write "对不起，添加失败，请用正确的方式添加商品！"
response.End
end if
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 shopdate,dazhe
'dazhe=round(request("huiyuanjia")/request("shichangjia"),2)
'if request("shopdateyear")<>"" then
'shopdate=trim(request("shopdateyear"))&"年"&trim(request("shopdatemonth"))&"月"
'else
'shopdate=""
'end if
dim action,shopid,Content,aa
shopid=request.QueryString("id")
action=request.QueryString("action")

Content=Request.Form("Content")

'将里面的链接换成本地链接
 aa="http://"&Request.ServerVariables("server_name")&Request.ServerVariables("path_info")
 aa= mid(aa,1,len(aa)-18)		'18=admin/newsedit.asp
content=replace(content,aa,"")
select case action
case "add"
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop_snsn",conn,1,3
rs.AddNew
rs("mch")=trim(request("mch")) '
rs("pp")=trim(request("pp")) '
rs("isbn1")=trim(request("isbn1")) '
rs("jj")=trim(request("jj")) '
rs("jg")=trim(request("jg")) '
rs("zl")=trim(request("zl")) '
rs("tp")=trim(request("tp")) '
rs("nr")=trim(request("nr")) '
rs("sftc")=trim(request("sftc")) 
if trim(request("lj"))="" then
rs("lj")="www"
else
rs("lj")=trim(request("lj"))
end if
rs("sx")=int(request("sx")) 
rs("anclassid")=int(request("anclassid")) '大类
rs("nclassid")=int(request("nclassid")) '小类
rs("shopname")=trim(request("shopname")) '商品名称
rs("pingpai")=trim(request("pingpai")) '商品品牌
rs("isbn")=trim(request("isbn")) '商品规格
rs("shopchuban")=trim(request("shopchuban")) '商品单位
rs("shichangjia")=trim(request("shichangjia"))  '市场价
rs("huiyuanjia")=trim(request("huiyuanjia"))  '会员价
rs("vipjia")=trim(request("vipjia"))  'VIP价
rs("kucun")=trim(request("kucun"))  '商品库存
rs("shoppic")=trim(request("shoppic"))  '小图片地址
rs("zhuang")=trim(request("zhuang")) '大图片地址
rs("p1")=trim(request("p1")) '配置图片一
rs("p2")=trim(request("p2")) '配置图片二
rs("p3")=trim(request("p3")) '配置图片三
rs("p4")=trim(request("p4")) '配置图片四
rs("shopcontent")=Content
rs("banci")=request("fudongjia")  '浮动价
rs("yeshu")=trim(request("yeshu"))  '商品积分
if request("bestshop")=1 then  '推荐
rs("bestshop")=1
else
rs("bestshop")=0
end if
if request("newsshop")=1 then  '新品
rs("newsshop")=1
else
rs("newsshop")=0
end if
if request("tejiashop")=1 then  '特价
rs("tejiashop")=1
else
rs("tejiashop")=0
end if
if request("cxiaoshop")=1 then  '促消
rs("cxiaoshop")=1
else
rs("cxiaoshop")=0
end if
rs("chengjiaocount")=0  '成交计数
rs("liulancount")=0  '浏览计数
rs("adddate")=now()  '加入日期
rs("pingji")=0  '评级人数
rs("pingjizong")=0 '总评级
'rs("shopmulu")=htmlencode2(trim(request("shopmulu")))  '目录
rs.Update
rs.Close
set rs=nothing
session("content")=""
response.Write "<script language=javascript>alert('添加成功！');window.location.href='addsn.asp';</script>"
response.End
case "edit"

session("content")=content
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop_snsn where shopid="&shopid,conn,1,3
rs("mch")=trim(request("mch")) '
rs("pp")=trim(request("pp")) '
rs("isbn1")=trim(request("isbn1")) '
rs("jj")=trim(request("jj")) '
rs("jg")=trim(request("jg")) '
rs("zl")=trim(request("zl")) '
rs("tp")=trim(request("tp")) '
rs("nr")=trim(request("nr")) '
rs("sftc")=trim(request("sftc")) 
if trim(request("lj"))="" then
rs("lj")="www"
else
rs("lj")=trim(request("lj"))
end if
rs("sx")=int(request("sx")) 
rs("anclassid")=int(request("anclassid")) '大类
rs("nclassid")=int(request("nclassid")) '小类
rs("shopname")=trim(request("shopname")) '商品名称
rs("pingpai")=trim(request("pingpai")) '商品品牌
rs("isbn")=trim(request("isbn")) '商品规格
rs("shopchuban")=trim(request("shopchuban")) '商品单位
rs("shichangjia")=trim(request("shichangjia"))  '市场价
rs("huiyuanjia")=trim(request("huiyuanjia"))  '会员价
rs("vipjia")=trim(request("vipjia"))  'VIP价
rs("kucun")=trim(request("kucun"))  '商品库存
rs("shoppic")=trim(request("shoppic"))  '小图片地址
rs("zhuang")=trim(request("zhuang")) '大图片地址
rs("p1")=trim(request("p1")) '配置图片一
rs("p2")=trim(request("p2")) '配置图片二
rs("p3")=trim(request("p3")) '配置图片三
rs("p4")=trim(request("p4")) '配置图片四
'rs("shopcontent")=htmlencode2(trim(request("shopcontent")))  '简介
rs("shopcontent")=content
rs("banci")=request("fudongjia")  '浮动价
rs("yeshu")=trim(request("yeshu"))  '商品积分
if request("bestshop")=1 then  '推荐
rs("bestshop")=1
else
rs("bestshop")=0
end if
if request("newsshop")=1 then  '新品
rs("newsshop")=1
else
rs("newsshop")=0
end if
if request("tejiashop")=1 then  '特价
rs("tejiashop")=1
else
rs("tejiashop")=0
end if
if request("cxiaoshop")=1 then  '促消
rs("cxiaoshop")=1
else
rs("cxiaoshop")=0
end if
rs.Update
rs.Close
set rs=nothing
session("content")=""
response.Write "<script language=javascript>alert('修改成功！');history.go(-1);</script>"
response.End
end select
%>