<% data_path="../../"   //'ACC连接数据库路径，对SQL无效 %>
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
 <!--#include file="../checkrole.asp"-->
  
<%

  call checkuser("cp")
	if issession=0 then
	username=Replace_Text(request.Cookies("Yxmember"))
	gsid=Replace_Text(request.Cookies("Yxmemberid"))
	else
	username=session("user")
	gsid=session("id")
	end if 
  Response.Buffer = true
  Response.ExpiresAbsolute=now()-1
  Response.Expires=0
  Response.CacheControl="no-cache"
 
if Not ChkPost then 
		response.write "<script language='javascript'>"
		response.write"parent.location.href='"&HOPE_InstallDir&"login/login1.asp';</SCRIPT>"
		response.end
end if
 
sql="select qymc from Websen_corporation where id="&gsid&""
Set rss= Server.CreateObject("ADODB.Recordset") 
rss.open sql,conn,1,1
qymc=rss("qymc")
rss.close
set rss=nothing


dim photoas,logoas,photopath,logopath
bigclassid=Replace_Text(Request.form("bigclassid"))
smallclassid=Replace_Text(Request.form("smallclassid"))
cpmc=Replace_Text(Request.form("cpmc"))
cpgg=Replace_Text(Request.form("cpgg"))
cpcd=Replace_Text(Request.form("cpcd"))
 proprice= Replace_Text(Request.form("proprice"))

//'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//'处理种类的id号 
 
sortid=Replace_Text(Request.form("p_z_Z_RootCategory"))                                 //'第一类
CategoryId=split(Replace_Text(Request.form("p_z_Z_CategoryId1")),",")
typeid=CategoryId(0)                                                                   // '第二类

if ubound(CategoryId)>=1 then
typeid_2=CategoryId(1)                                                                 // '第三类     
	else
typeid_2=0
	end if
	
	if typeid="" then
    typeid=0
	end if
	if typeid_2="" then
    typeid_2=0
	end if
   
//'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
p_z_Z_Keywords=Replace_Text(Request.form("p_z_Z_Keywords"))
xxsm=Replace_Text(Request.form("xxsm"))
more_info=Replace_Text(Request.form("more_info"))
cpsb=Replace_Text(Request.form("cpsb"))
Quantity=Replace_Text(Request.form("Quantity"))
Packaging=Replace_Text(Request.form("Packaging"))
cpjg=Replace_Text(Request.form("cpjg"))
 yx_pic=Replace_Text(Request.form("yx_pic"))
yx_pic2=Replace_Text(Request.form("yx_pic2"))
iscpbj=Replace_Text(Request.form("iscpbj"))
if iscpbj="" then 
iscpbj=0
end if 
xxsm=replace(xxsm,"<","[")
xxsm=replace(xxsm,">","]")
 Set rst= Server.CreateObject("ADODB.Recordset") 
sq="select * from websen_Dirty where type=2"
rst.open sq,conn,1,1
word=rst("Dirty")
dim a,s,i,l,o
bytes=split(word,",")
i=0
      for ii=0 to ubound(bytes)
		s=Instr(xxsm,bytes(ii))
		
		if s then  
		m=1
		str=str&bytes(ii)&"|"	  
		else
		i=i+1
		end if
     next
 if m=1  then
	
response.Write("<script >alert('您输入的信息不合法!');window.location.href='add_product.asp?str="&str&"';</script >")
	
		  rst.close	
	 else
 
 
 
 
user=username
set rs=server.createobject("adodb.recordset")
sql="select * from Websen_productshow where cpmc='"&cpmc&"' and cpgg='"&cpgg&"' and gsid="&gsid&""
 rs.open sql,conn,1,3
if not rs.eof then
	response.write"<SCRIPT language=JavaScript>alert('对不起，您已经提交过此产品！');"
	response.write"javascript:history.go(-1)</SCRIPT>"
	response.end 
else
rs.addnew
rs("cpmc")=cpmc
rs("cpgg")=cpgg
rs("cpcd")=cpcd
rs("sortid")=sortid
rs("typeid")=typeid
rs("typeid_2")=typeid_2


//'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if yx_pic="" and yx_pic2="" then 
 rs("picture")="../../UploadFile/nopicture.gif"
rs("picture_summ")="../../UploadFile/nopicture.gif"
elseif yx_pic2<>"" and yx_pic="" then 
rs("picture")=yx_pic2
rs("picture_summ")=yx_pic2
elseif yx_pic2="" and yx_pic<>"" then 
rs("picture")=yx_pic
rs("picture_summ")=yx_pic
else 
rs("picture")=yx_pic2
rs("picture_summ")=yx_pic
end if 
//'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rs("iscpbj")=iscpbj //'产品报价
rs("proprice")=proprice
rs("keywords")=p_z_Z_Keywords
rs("xxsm")=xxsm
rs("cpsb")=cpsb
rs("Quantity")=Quantity
rs("Packaging")=Packaging
rs("cpjg")=cpjg
rs("idate")=now()
 rs("gsid")=gsid
rs("bigclassid")=bigclassid
rs("smallclassid")=smallclassid
if citycpkey=1 then
 rs("flag")=1
 else
 rs("flag")=0
 end if
 rs("hits")=1
rs("FeedbackFlag")=1
rs.update()
	id1=rs("id")
	id2=rs("id")
rs.close
set rs=nothing

   if citycpkey then
	set rsb=server.CreateObject("adodb.recordset")
	sqlc="select  * from  Websen_worldec_config "
     rsb.open sqlc,conn,1,1     
    cpmark=rsb("cpmark")
	rsb.close
	set rsb=nothing
	set rsc=server.CreateObject("adodb.recordset")
	sqlc="select  * from  Websen_corporation where id="&gsid   
     rsc.open sqlc,conn,1,3     
	rsc("mark")=rsc("mark")+cpmark
	rsc.update
    rsc.close
	set rsc=nothing
   end if
   
    if citycpkey=1 then 
	 %>  
	  <iframe src="../../manage/Autohtml/productshow/makedetail.asp?all=update&id1=<%=id1%>&id2=<%=id2%>&schtml=开始生成>>&M_other=Product" frameborder="0" scrolling="no" width=0 height=0></iframe>
  <%
	end if
	
	
//'自动生成用户网站*******20080420********************************
	 
if issession=0 then
   gradeid=Replace_Text(request.Cookies("gradeid"))
else
   gradeid=session("gradeid")
end if 		 
rolelist="no"
set rsgg=server.CreateObject("adodb.recordset")
sqlgg=" select rolelist from Websen_vipgrade where  roleid="&gradeid
rsgg.open sqlgg,conn,1,1
if not rsgg.eof then
   rolelist=rsgg("rolelist")
   rsgg.close
end if
if instr(rolelist,"qw")>0 then
   if autozz=1 and citycpkey="1" then
      %>
      <iframe src=" ../co.asp	" frameborder="0" scrolling="no" width=0 height=0></iframe>
      <%
   end if
//else

end if   

//****************************************************************
  end if
  end if
   %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>操作成功</title>
<link href="../../images/css.css" rel="stylesheet" type="text/css">
<meta HTTP-EQUIV=refresh Content='3;url=edit.asp'>
</head>

<%
Content="<center>恭喜您，您的产品已经发布成功!<br><input name='' type='button' value='返回' onclick='javascript:history.go(-1)'></center>"

Call Operation(Content,1)
Response.end
conn.close
set conn=nothing
%>
<body>
</body>
</html>