<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/asptar.asp"-->
<!-- #include file="upfile/class_upfile.asp" -->
<!--#include file="../include/config.inc"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 eshop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 admin_product_csv.asp
'* 最后更新 2013-03-21 by 56770.kingdge
'*****************************************
admin_flag=",2.8,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_product.inc"
CurrentId = 1
CurrentUrl = "admin_product_csv.asp"
datatype = checknum(request("datatype"),1)
if Eshop_Lebi_name="" or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
		LB_Head()
		LB_Menu()
		%>
		<div class="tabmenu mainwidth">
			  <ul>
				<li class="current"><a href="?datatype=1"><span><%=Lang_Product(156)%></span></a></li>
				<li><a href="?datatype=2"><span><%=Lang_Product(157)%></span></a></li>
			  </ul>
		</div>
		<%
		Response.Write("<div class=""tab-mainbody"">")
		Response.Write("<div class=""tab-mainbody2"">")
	    adminflag()
		Response.Write("</div>")
		Response.Write("</div>")
		LB_Footer()
Else
		If OutSubmit = 1 Then CheckOutSubmit()
	    select case request("action")
	    	   case "ducting" : ducting()
			   case "lead" : lead()
			   Case "down" : down()
			   Case "saveremotefile" : saveremotefile()
	    	   case Else
	    		    productlist()
	    end select
End If

Function Savehtml(filename,filebody)
		On Error Resume Next
        filename = server.mappath(filename)
        adTypeText=2
        adSaveCreateOverWrite=2
        Set objStream = Server.CreateObject("ADODB.Stream")
        With objStream
                .Type = adTypeText
                .Mode = adModeReadWrite
                .Open
                .Charset = "gb2312"
                .Position = objStream.Size
                .WriteText= filebody
                .SaveToFile FileName,adSaveCreateOverWrite
                .Close
        End With
End Function

Function ReplaceRemoteFile(ConStr,IncluL,IncluR,SaveTf,SaveFilePath,ThisUrl,id)
		On Error Resume Next 
        If ThisUrl = "/" Or ThisUrl = "" Then
				If request.ServerVariables("SERVER_PORT") <> 80 Then
						ThisUrl="http://"&Request.ServerVariables("SERVER_NAME")&":"&request.ServerVariables("SERVER_PORT")&"/"
				Else
						ThisUrl="http://"&Request.ServerVariables("SERVER_NAME")&"/"
				End If
		End If
        If ConStr="$False$" or ConStr="" or IsNull(ConStr) Then
                ReplaceRemoteFile="$False$"
                Exit Function
        End If
        Dim TempStr,TempStr2,ReF,Matches,Match,Tempi,TempArray,TempArray2,OverTypeArray,StartStr,OverStr
        '图片开始的字符串
        StartStr="src="
        '图片结束的字符串
        OverStr="gif|jpg|bmp|jpeg|png"
        Set ReF = New Regexp
        ReF.IgnoreCase = True
        ReF.Global = True
        ReF.Pattern = "("&StartStr&").+?("&OverStr&")"
        Set Matches =ReF.Execute(ConStr)
        For Each Match in Matches
                If Instr(TempStr,Match.Value)=0 Then
                        If TempStr<>"" then
                                TempStr=TempStr & "$Array$" & Match.Value
                        Else
                                TempStr=Match.Value
                        End if
                End If
        Next
        Set Matches=nothing
        Set ReF=nothing
        If TempStr="" or IsNull(TempStr)=True Then
                ReplaceRemoteFile=ConStr
                Exit function
        End if
        If IncluL=False then
                TempStr=Replace(TempStr,StartStr,"")
        End if
        If IncluR=False then
                If Instr(OverStr,"|")>0 Then
                        OverTypeArray=Split(OverStr,"|")
                        For Tempi=0 To Ubound(OverTypeArray)
                                TempStr=Replace(TempStr,OverTypeArray(Tempi),"")
                        Next
                Else
                        TempStr=Replace(TempStr,OverStr,"")
                End If
        End if
        TempStr=Replace(TempStr,"""","")
        TempStr=Replace(TempStr,"'","")
        Dim RemoteFile,RemoteFileurl,SaveLocalFileName,SaveFileType,ArrSaveLocalFileName,RanNum
        If Right(SaveFilePath,1)="/" then
                SaveFilePath=Left(SaveFilePath,Len(SaveFilePath)-1)
        End If
        If SaveTf=True then
                If CheckDir2(SaveFilePath)=False Then
                        If MakeNewsDir2(SaveFilePath)=False Then
                                SaveTf=False
                        End If
                End If
        End If
        SaveFilePath= RemoteFileCreatePath(SaveFilePath)
        '图片转换/保存
        TempArray=Split(TempStr,"$Array$")
        For Tempi=0 To Ubound(TempArray)
                RemoteFileurl=DefiniteUrl(TempArray(Tempi),ThisUrl)
				If InStr(RemoteFileurl,ThisUrl)=0 Then
                If RemoteFileurl<>"$False$" And SaveTf=True Then'保存图片
                        ArrSaveLocalFileName = Split(RemoteFileurl,".")
                        SaveFileType=ArrSaveLocalFileName(Ubound(ArrSaveLocalFileName))'文件类型
                        RanNum=Int(900*Rnd)+100
                        SaveLocalFileName = SaveFilePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&SaveFileType
'						dim Ads,Retrieval,GetRemoteData
'						Set Retrieval = CreateObject("Micro"&"soft"&"."&"XML"&"HTTP")
'						With Retrieval
'						.Open "Get", RemoteFileurl, False, "", ""
'						.Send
'						GetRemoteData = .ResponseBody
'						End With
'						Set Retrieval = Nothing
'						Set Ads = Server.CreateObject("ado"&"db"&"."&"str"&"eam")
'						With Ads
'						.Type = 1
'						.Open
'						.Write GetRemoteData
'						.SaveToFile server.MapPath(SaveLocalFileName),2
'						.Cancel()
'						.Close()
'						End With
'						Set Ads=Nothing
						Set r_rs = server.CreateObject("adodb.recordset")
						r_rs.open "select pid,r_remote,r_local from [Lebi_RemotePic] where pid = "& id &" and r_remote = '"& TempArray(Tempi) &"'",conn,1,3
						If r_rs.eof Then 
								r_rs.addnew
								r_rs(0) = id
								r_rs(1) = TempArray(Tempi)
								r_rs(2) = Replace(SaveLocalFileName,"../","")
								r_rs.update
						End If 
						r_rs.close : Set r_rs = Nothing 
						ConStr=Replace(ConStr,TempArray(Tempi),ThisUrl &Replace(SaveLocalFileName,"../",""))
                ElseIf RemoteFileurl<>"$False$" and SaveTf=False Then'不保存图片
                        SaveLocalFileName=RemoteFileUrl
                        ConStr=Replace(ConStr,TempArray(Tempi),SaveLocalFileName)
                End If
                If RemoteFileUrl<>"$False$" Then
                        If UploadFiles="" then
                                UploadFiles=SaveLocalFileName
                        Else
                                UploadFiles=UploadFiles & "|" & SaveLocalFileName
                        End if
                End If
				End If
        Next
        ReplaceRemoteFile=ConStr
End Function

Sub saveremotefile()
	    server.scripttimeout=9999999
		id = checknum(request("id"),0)
		If id = 0 Then 
				Set GetStart = Conn.execute("select top 1 id from [Lebi_product] where html = 2 order by id asc")
				If Not GetStart.eof Then
						id = GetStart(0)
				End If
				GetStart.close
		End If 
		s = checknum(request("s"),1)
		e = checknum(request("e"),3)
		LB_Head()
		LB_Menu()
		%>
		<div class="tabmenu mainwidth">
			  <ul>
				<li><a href="?datatype=1"><span><%=Lang_Product(156)%></span></a></li>
				<li class="current"><a href="?datatype=2"><span><%=Lang_Product(157)%></span></a></li>
			  </ul>
		</div>
		<%
		Response.Write("<div class=""tab-mainbody"">")
		Response.Write("<div class=""tab-mainbody2"">")
		Set GetLast = Conn.execute("select top 1 id from [Lebi_product] where html = 2 order by id desc")
		If Not GetLast.eof Then
				LastId = GetLast(0)
		End If
		GetLast.close
		Set rs = server.CreateObject("adodb.recordset")
		sql = "select * from [Lebi_product] where html = 2 and id = "& id &""
		rs.open sql,conn,1,3
		If Not rs.eof Then 
				pname = rs("product_name")
				For LangT = 1 To TotalLang
						FilesPath="../pic/userfiles/image/"
						ThisUrl=replace(lcase(Request.ServerVariables("URL")),LCase(AdminPath) &"/admin_product_csv.asp","")
						rs("details" & LanguageTxt(LangT))=ReplaceRemoteFile(rs("details" & LanguageTxt(LangT)),False,True,True,FilesPath,ThisUrl,id)
				Next
				rs("html") = 1
				rs.update
		End If 
		rs.close:Set rs=Nothing
		r_startid = checknum(request("r_startid"),0)
		If r_startid = 0 Then 
				Set GetStart = Conn.execute("select top 1 r_id from [Lebi_RemotePic] where pid = "& id &" order by r_id asc")
				If Not GetStart.eof Then
						r_startid = GetStart(0)
				End If
				GetStart.close
		End If 
		r_endid = checknum(request("r_endid"),0)
		If r_endid = 0 Then r_endid = r_startid+3
		Set GetLast = Conn.execute("select top 1 r_id from [Lebi_RemotePic] where pid = "& id &" order by r_id desc")
		If Not GetLast.eof Then
				r_LastId = GetLast(0)
		End If
		GetLast.close
		Set rs = server.CreateObject("adodb.recordset")
		sql = "select r_remote,r_local from [Lebi_RemotePic] where pid = "& id &""
		If r_endid > 0 Then
				sql = sql &" and (r_id >= "& r_startid &" and r_id <= "& r_endid &")"
		End If
		sql = sql &" order by r_id asc"
		rs.open sql,conn,1,3
		If Not rs.eof Then 
		Do While Not rs.eof 
				On Error Resume Next 
				Set Retrieval = CreateObject("Micro"&"soft"&"."&"XML"&"HTTP")
				With Retrieval
				.Open "Get", rs(0), False, "", ""
				.Send
				GetRemoteData = .ResponseBody
				End With
				Set Retrieval = Nothing
				Set Ads = Server.CreateObject("ado"&"db"&"."&"str"&"eam")
				With Ads
				.Type = 1
				.Open
				.Write GetRemoteData
				.SaveToFile server.MapPath("../"& rs(1)),2
				.Cancel()
				.Close()
				End With
				Set Ads=Nothing
				rs.delete
				rs.update
		rs.movenext 
		Loop 
		End If 
		rs.close : Set rs = Nothing 
		If CLng(r_LastId) > CLng(r_startid) Then
				Set rs = conn.execute("select product_name from [Lebi_product] where id = "& id &"")
				If Not rs.eof Then 
						pname = rs(0)
				End If 
				rs.close:Set rs=Nothing
				Call Up_mes(Replace(Replace(Lang_Product(235),"$1",pname),"$2",s &"-"& e),"·"& Replace(Lang_sys(83),"[time]",3) &"",0,"?action=saveremotefile&id="& id &"&r_startid="& r_endid + 1 &"&r_endid="& r_endid + 3 &"&s="& s + 3 &"&e="& e + 3 &"",0,0,3,1)
		Else 
				If CLng(LastId) > CLng(id) Then
						Call Up_mes(Lang_Product(233),"·"& Replace(Lang_sys(83),"[time]",3) &"",0,"?action=saveremotefile&id="& id + 1 &"&r_startid=0&r_endid=0",0,0,3,1)
				Else
						Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,"?datatype=2",0,0,2,1)
				End If
		End If 
		Response.Write("</div>")
		Response.Write("</div>")
		LB_Footer()
End Sub 

sub ducting()
		LB_Head()
		LB_Menu()
		%>
		<div class="tabmenu mainwidth">
			  <ul>
				<li><a href="?datatype=1"><span><%=Lang_Product(156)%></span></a></li>
				<li class="current"><a href="?datatype=2"><span><%=Lang_Product(157)%></span></a></li>
			  </ul>
		</div>
		<%
		Response.Write("<div class=""tab-mainbody"">")
		Response.Write("<div class=""tab-mainbody2"">")
		If OnlyRead = 1 Then OnlyReadMessage()
	    server.scripttimeout=9999999
		Dim filetype,csvi(20)
	    dim upload,filepath,formname,file,f_filename,f_viewname,delcsvNum
	    dim drawinfo
		delcsvNum = 0
		upfiletype="txt,csv,xls"
		onesize="20480000" '2000kb
		filepath = "excel/"
		filepath=createpath(filepath)
		drawinfo = ""
		set upload_lebi = new upfile_cls
		upload_lebi.uploadtype		= upload_type			'设置上传组件类型
		upload_lebi.uploadpath		= filepath								'设置上传路径
		upload_lebi.maxsize			= int(onesize)							'单位 kb
		upload_lebi.inceptmaxfile		= 1										'每次上传文件个数上限
		upload_lebi.inceptfiletype		= upfiletype							'设置上传文件限制
		upload_lebi.rname			= ""                                                          '文件名前缀
		upload_lebi.chksessionname		= "uploadcode"
		upload_lebi.previewtype			= 999
		upload_lebi.previewimagewidth	= pic_xw										'设置预览图片宽度
		upload_lebi.previewimageheight	= pic_xh										'设置预览图片高度
		upload_lebi.drawimagewidth		= upload_drawwidth						'设置水印图片或文字区域宽度
		upload_lebi.drawimageheight		= upload_drawhight						'设置水印图片或文字区域高度
		upload_lebi.drawgraph		= upload_drawgraph						'设置水印透明度
		upload_lebi.drawfontcolor		= upload_drawcolor						'设置水印文字颜色
		upload_lebi.drawfontfamily		= upload_drawfont						'设置水印文字字体格式
		upload_lebi.drawfontsize		= upload_drawfontsize						'设置水印文字字体大小
		upload_lebi.drawfontbold		= upload_drawfontbold						'设置水印文字是否粗体
		upload_lebi.drawinfo			= drawinfo					'设置水印文字信息或图片信息
		upload_lebi.drawtype			= upload_isdraw						'0=不加载水印 ，1=加载水印文字，2=加载水印图片
		upload_lebi.drawxytype		= upload_drawxytype						'"0" =左上，"1"=左下,"2"=居中,"3"=右上,"4"=右下
		upload_lebi.drawsizetype		= 1						'"0"=固定缩小，"1"=等比例缩小
		if upload_drawpiccolor<>"" or upload_drawpiccolor<>"0" then
				upload_lebi.transitioncolor	= upload_drawpiccolor			'透明度颜色设置
		end If
		upload_lebi.saveupfile
		if upload_lebi.errcodes<>0 Then
				call up_mes(Lang_sys(46),"·"& upload_lebi.description,0,"javascript:history.back()",0,0,2,0)
		end If
		if upload_lebi.count > 0 then
				for each formname in upload_lebi.uploadfiles
						set file = upload_lebi.uploadfiles(formname)
						f_filename = filepath & file.filename
						filetype = upload_lebi.uploadforms("filetype")
						LangT = Trim(upload_lebi.uploadforms("LangT"))
						categoryid = replace(trim(upload_lebi.uploadforms("categoryid"))," ","")
						savetype = upload_lebi.uploadforms("savetype")
						uptype = upload_lebi.uploadforms("uptype")
						savecode = checknum(upload_lebi.uploadforms("savecode"),0)
						If savecode = 2 And (filetype = 2 Or filetype = 3) Then 
								savecode = CheckCode(filepath & file.filename)
								If savecode = "unicode" Then 
										savecode = 1
								Else
										savecode = 0
								End If 
						End If 
						On Error Resume Next
						If filetype = 1 Or (filetype = 2 And savecode = 0) Or (filetype = 3 And savecode = 0) Then 
								Set csvConn = Server.CreateObject("ADODB.Connection")
								csvConn.open "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ="& Server.MapPath(filepath) &";Extensions=csv;Persist Security Info=False" '"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath(filepath) &";Extended Properties='text;HDR=Yes;FMT=Delimited'"
								If Err<>0 Then
										Response.Write Err.Description
										Response.End()
								End if
								cvsDataCount = 0
								Set csvrs=csvconn.Execute("select * from "& file.filename &"")
								If Not (csvrs.eof or csvrs.bof) Then
										cvsDataCount = 1
										cvsDataList = csvrs.GetRows()
								End If
								csvrs.Close:Set csvrs=Nothing
								If cvsDataCount = 0 Then
										call up_mes(Lang_sys(46),"·"& Lang_Product(146),0,"javascript:history.back()",0,0,2,0)
								End If
						End If 
						sql="select grade_dj,grade_name from [Lebi_user_grade] where grade_dj <> 0 order by grade_dj"
						set rs = conn.execute(sql)
						If Not rs.eof Then 
								GradeData = rs.getrows()
						End If 
						rs.close:Set rs = Nothing
						GradeNum = UBound(GradeData,2)
						Select Case filetype
							   Case "1"
									For ii = 0 To Ubound(cvsDataList,2)
											If safereplace(cvsDataList(1,ii)) <> "" Then
											set inexcel = server.createobject("adodb.recordset")
											inexcelsql = "select * from [lebi_product] where"
											Select Case uptype
											Case "1" inexcelsql = inexcelsql &" product_name = '"& safereplace(cvsDataList(1,ii)) &"'"
											Case "2" inexcelsql = inexcelsql &" bianhao = '"& safereplace(cvsDataList(0,ii)) &"'"
											Case "3" inexcelsql = inexcelsql &" (product_name = '"& safereplace(cvsDataList(1,ii)) &"' and bianhao = '"& safereplace(cvsDataList(0,ii)) &"')"
											End Select 
											inexcel.open inexcelsql,conn,1,3
											if inexcel.eof then
													inexcel.addnew
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													if trim(cvsDataList(0,ii)) <> "" then
															inexcel("bianhao") = safereplace(cvsDataList(0,ii))
													end if
													If LangT = 999 Then
															For T = 1 To TotalLang
																	If T = 1 Then 
																			Lang_product_name = safereplace(cvsDataList(1,ii))
																			Lang_brand = safereplace(cvsDataList(2,ii))
																			Lang_briefed = replace(cvsDataList(16+GradeNum,ii),"'","&#180;")
																			Lang_details = replace(cvsDataList(17+GradeNum,ii),"'","&#180;")
																			Lang_pro_name = replace(cvsDataList(19+GradeNum,ii),"'","&#180;")
																			Lang_pro_info = replace(cvsDataList(20+GradeNum,ii),"'","&#180;")
																	ElseIf T = 2 Then 
																			Lang_product_name = safereplace(cvsDataList(1+20+GradeNum,ii))
																			Lang_brand = safereplace(cvsDataList(2+20+GradeNum,ii))
																			Lang_briefed = replace(cvsDataList(3+20+GradeNum,ii),"'","&#180;")
																			Lang_details = replace(cvsDataList(4+20+GradeNum,ii),"'","&#180;")
																			Lang_pro_name = replace(cvsDataList(5+20+GradeNum,ii),"'","&#180;")
																			Lang_pro_info = replace(cvsDataList(6+20+GradeNum,ii),"'","&#180;")
																	Else
																			Lang_product_name = safereplace(cvsDataList(1+20+GradeNum+(6*(T-2)),ii))
																			Lang_brand = safereplace(cvsDataList(2+20+GradeNum+(6*(T-2)),ii))
																			Lang_briefed = replace(cvsDataList(3+20+GradeNum+(6*(T-2)),ii),"'","&#180;")
																			Lang_details = replace(cvsDataList(4+20+GradeNum+(6*(T-2)),ii),"'","&#180;")
																			Lang_pro_name = replace(cvsDataList(5+20+GradeNum+(6*(T-2)),ii),"'","&#180;")
																			Lang_pro_info = replace(cvsDataList(6+20+GradeNum+(6*(T-2)),ii),"'","&#180;")
																	End If 
																	inexcel("product_name" & LanguageTxt(T))=Lang_product_name
																	inexcel("brand" & LanguageTxt(T))=Lang_brand
																	inexcel("briefed" & LanguageTxt(T))=Lang_briefed
																	inexcel("details" & LanguageTxt(T))=Lang_details
																	inexcel("webhead" & LanguageTxt(T)) = "$$$$$$"
																	inexcel("pro_name" & LanguageTxt(T))=Lang_pro_name
																	inexcel("pro_info" & LanguageTxt(T))=Lang_pro_info
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(cvsDataList(1,ii))
															inexcel("brand" & LanguageTxt(LangT))=safereplace(cvsDataList(2,ii))
															inexcel("briefed" & LanguageTxt(LangT))=replace(cvsDataList(16+GradeNum,ii),"'","&#180;")
															inexcel("details" & LanguageTxt(LangT))=replace(cvsDataList(17+GradeNum,ii),"'","&#180;") 
															For LangT = 1 To TotalLang
																	inexcel("webhead" & LanguageTxt(LangT)) = "$$$$$$"
																	inexcel("pro_name" & LanguageTxt(LangT))=replace(cvsDataList(19+GradeNum,ii),"'","&#180;") 
																	inexcel("pro_info" & LanguageTxt(LangT))=replace(cvsDataList(20+GradeNum,ii),"'","&#180;")
															Next
													End If
													inexcel("kucun") = checknum(cvsDataList(3,ii),0)
													inexcel("zhuangtai") = checknum(cvsDataList(4,ii),1)
													inexcel("sprice") = checknum(cvsDataList(5,ii),0)
													inexcel("cbprice") = checknum(cvsDataList(6,ii),0)
													inexcel("cx") = checknum(cvsDataList(8+GradeNum,ii),0)
													inexcel("cprice") = checknum(cvsDataList(9+GradeNum,ii),0)
													inexcel("stj") = checknum(cvsDataList(10+GradeNum,ii),0)
													inexcel("ytj") = checknum(cvsDataList(11+GradeNum,ii),0)
													inexcel("p_jifen") = checknum(cvsDataList(12+GradeNum,ii),0)
													inexcel("p_weight") = checknum(cvsDataList(13+GradeNum,ii),0)
													inexcel("pic") = safereplace(cvsDataList(14+GradeNum,ii))
													inexcel("cpic") = safereplace(cvsDataList(15+GradeNum,ii))
													inexcel("p_tags") = safereplace(cvsDataList(18+GradeNum,ii))
													inexcel("p_order") = checknum(cvsDataList(UBound(cvsDataList,1),ii),0)
													inexcel("p_cx_sj") = 0
													inexcel("p_stj_sj") = 0
													inexcel("p_ytj_sj") = 0
													inexcel("p_chima") = ",,"
													inexcel("p_color") = ",,"
													inexcel("p_gongxiao") = ",,"
													inexcel("p_person") = ",,"
													inexcel("sj") = now()
													inexcel("p_filename") = safereplace(cvsDataList(0,ii))
													inexcel.update
													set getid = conn.execute("select top 1 id from [lebi_product] order by id desc")
													id = getid("id")
													getid.close:set getid=nothing
													if safereplace(cvsDataList(0,ii)) = "" then
															bianhao = date()
															bianhao = replace(bianhao, "-", "")
															bianhao = replace(bianhao, " ", "")
															bianhao = replace(bianhao, ":", "")
															bianhao = bianhao & id
													else
															bianhao = safereplace(cvsDataList(0,ii))
													end If
													conn.execute "update [lebi_product] set bianhao='"& bianhao &"' where id=" & id&""
													For i = 0 To UBound(GradeData,2)
															conn.execute("insert into [lebi_product_price] (product_id,grade_id,price)values("& id &","& GradeData(0,i) &","& checknum(safereplace(cvsDataList(7+i,ii)),0) &")")
													Next 
											Else
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For T = 1 To TotalLang
																	If T = 1 Then 
																			Lang_product_name = safereplace(cvsDataList(1,ii))
																			Lang_brand = safereplace(cvsDataList(2,ii))
																			Lang_briefed = replace(cvsDataList(16+GradeNum,ii),"'","&#180;") 
																			Lang_details = replace(cvsDataList(17+GradeNum,ii),"'","&#180;") 
																			Lang_pro_name = replace(cvsDataList(19+GradeNum,ii),"'","&#180;") 
																			Lang_pro_info = replace(cvsDataList(20+GradeNum,ii),"'","&#180;") 
																	ElseIf T = 2 Then 
																			Lang_product_name = safereplace(cvsDataList(1+20+GradeNum,ii))
																			Lang_brand = safereplace(cvsDataList(2+20+GradeNum,ii))
																			Lang_briefed = replace(cvsDataList(3+20+GradeNum,ii),"'","&#180;")
																			Lang_details = replace(cvsDataList(4+20+GradeNum,ii),"'","&#180;")
																			Lang_pro_name = replace(cvsDataList(5+20+GradeNum,ii),"'","&#180;") 
																			Lang_pro_info = replace(cvsDataList(6+20+GradeNum,ii),"'","&#180;") 
																	Else
																			Lang_product_name = safereplace(cvsDataList(1+20+GradeNum+(6*(T-2)),ii))
																			Lang_brand = safereplace(cvsDataList(2+20+GradeNum+(6*(T-2)),ii))
																			Lang_briefed = replace(cvsDataList(3+20+GradeNum+(6*(T-2)),ii),"'","&#180;")
																			Lang_details = replace(cvsDataList(4+20+GradeNum+(6*(T-2)),ii),"'","&#180;")
																			Lang_pro_name = replace(cvsDataList(5+20+GradeNum+(6*(T-2)),ii),"'","&#180;") 
																			Lang_pro_info = replace(cvsDataList(6+20+GradeNum+(6*(T-2)),ii),"'","&#180;") 
																	End If 
																	inexcel("product_name" & LanguageTxt(T))=Lang_product_name
																	inexcel("brand" & LanguageTxt(T))=Lang_brand
																	inexcel("briefed" & LanguageTxt(T))=Lang_briefed
																	inexcel("details" & LanguageTxt(T))=Lang_details
																	inexcel("webhead" & LanguageTxt(T)) = "$$$$$$"
																	inexcel("pro_name" & LanguageTxt(T))=Lang_pro_name
																	inexcel("pro_info" & LanguageTxt(T))=Lang_pro_info
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(cvsDataList(1,ii))
															inexcel("brand" & LanguageTxt(LangT))=safereplace(cvsDataList(2,ii))
															inexcel("briefed" & LanguageTxt(LangT))=replace(cvsDataList(16+GradeNum,ii),"'","&#180;")
															inexcel("details" & LanguageTxt(LangT))=replace(cvsDataList(17+GradeNum,ii),"'","&#180;")
															inexcel("webhead" & LanguageTxt(LangT)) = "$$$$$$"
															inexcel("pro_name" & LanguageTxt(LangT))=replace(cvsDataList(19+GradeNum,ii),"'","&#180;")
															inexcel("pro_info" & LanguageTxt(LangT))=replace(cvsDataList(20+GradeNum,ii),"'","&#180;")
													End If
													inexcel("kucun") = checknum(cvsDataList(3,ii),0)
													inexcel("zhuangtai") = checknum(cvsDataList(4,ii),1)
													inexcel("sprice") = checknum(cvsDataList(5,ii),0)
													inexcel("cbprice") = checknum(cvsDataList(6,ii),0)
													inexcel("cx") = checknum(cvsDataList(8+GradeNum,ii),0)
													inexcel("cprice") = checknum(cvsDataList(9+GradeNum,ii),0)
													inexcel("stj") = checknum(cvsDataList(10+GradeNum,ii),0)
													inexcel("ytj") = checknum(cvsDataList(11+GradeNum,ii),0)
													inexcel("p_jifen") = checknum(cvsDataList(12+GradeNum,ii),0)
													inexcel("p_weight") = checknum(cvsDataList(13+GradeNum,ii),0)
													inexcel("pic") = safereplace(cvsDataList(14+GradeNum,ii))
													inexcel("cpic") = safereplace(cvsDataList(15+GradeNum,ii))
													inexcel("p_tags") = safereplace(cvsDataList(18+GradeNum,ii))
													inexcel("p_order") = checknum(cvsDataList(UBound(cvsDataList,1),ii),0)
													inexcel("sj") = now()
													If Null(inexcel("p_filename")) Or inexcel("p_filename") = "" Then inexcel("p_filename") = safereplace(cvsDataList(0,ii))
													inexcel.update
													For i = 0 To UBound(GradeData,2)
															conn.execute("update [lebi_product_price] set price="& checknum(safereplace(cvsDataList(7+i,ii)),0) &" where product_id="& inexcel("id") &" and grade_id="& GradeData(0,i) &"")
													Next 
											end if
											inexcel.close : set inexcel = nothing
											End If
										Next
							   Case "2"
									StartRow = 0
									csvNum = 0
									delcsvNum = 0
									RowTitle = ""
									If savecode = 1 Then 
									Set Fso = Server.CreateObject("Scripting.FileSystemObject")
									Set csvFile = Fso.OpenTextFile(Server.MapPath(Eshop_url & AdminPath &"/excel/"& file.filename),1,True,-1)
									While Not csvFile.AtEndOfStream
									row = Split(csvFile.ReadLine,"	")
									If InStr(row(0),"version") > 0 Then StartRow = 1
									If row(0) = "title" Then StartRow = 2
									If csvNum = StartRow Then
											for i = 0 to ubound(row)
													csvVar=row(i)
													RowTitle = RowTitle & row(i)
													Select Case csvVar   
													Case "宝贝名称" csvi(0) = i    
													Case "商家编码" csvi(1) = i
													Case "宝贝价格" csvi(2) = i
													Case "宝贝数量" csvi(3) = i
													Case "宝贝描述" csvi(4) = i
													Case "橱窗推荐" csvi(5) = i
													Case "新图片" csvi(6) = i
													End Select
											next	
									End If
									if InStr(row(csvi(0)),"version") > 0 then 
										delcsvNum = delcsvNum + 1
									End If 
									if row(csvi(0)) = "title" then 
										delcsvNum = delcsvNum + 1
									End If 
									if row(csvi(0)) = "宝贝名称" then 
										delcsvNum = delcsvNum + 1
									End If 
									if InStr(row(csvi(0)),"version") = 0 And row(csvi(0)) <> "title" And row(csvi(0)) <> "宝贝名称" And safereplace(GetCsvValue(row(csvi(0)))) <> ""  then 
											If safereplace(GetCsvValue(row(csvi(3)))) <> "" Then 
											set inexcel = server.createobject("adodb.recordset")
											inexcelsql = "select * from [lebi_product] where"
											Select Case uptype
											Case "1" inexcelsql = inexcelsql &" product_name = '"& safereplace(GetCsvValue(row(csvi(0)))) &"'"
											Case "2" inexcelsql = inexcelsql &" bianhao = '"& safereplace(GetCsvValue(row(csvi(1)))) &"'"
											Case "3" inexcelsql = inexcelsql &" (product_name = '"& safereplace(GetCsvValue(row(csvi(0)))) &"' and bianhao = '"& safereplace(GetCsvValue(row(csvi(1)))) &"')"
											End Select 
											inexcel.open inexcelsql,conn,1,3
											If inexcel.eof Then 
													inexcel.addnew
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(4))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
															inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(4))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
													End If
													For LangT = 1 To TotalLang
															inexcel("brand" & LanguageTxt(LangT))=""
															inexcel("briefed" & LanguageTxt(LangT))=""
															inexcel("webhead" & LanguageTxt(LangT)) = "$$$$$$"
															inexcel("pro_name" & LanguageTxt(LangT)) = "$"
															inexcel("pro_info" & LanguageTxt(LangT)) = "$$$"
													Next
													inexcel("bianhao") = safereplace(GetCsvValue(row(csvi(1))))
													inexcel("kucun") = checknum(GetCsvValue(row(csvi(3))),0)
													inexcel("zhuangtai") = 1
													inexcel("sprice") = checknum(GetCsvValue(row(csvi(2))),0)
													inexcel("cbprice") = checknum(GetCsvValue(row(csvi(2))),0)
													inexcel("cx") = 0
													inexcel("cprice") = 0
													inexcel("stj") = checknum(GetCsvValue(row(csvi(5))),0)
													inexcel("ytj") = checknum(GetCsvValue(row(csvi(5))),0)
													inexcel("p_jifen") = 0
													inexcel("p_weight") = 0
													cpic = safereplace(GetCsvValue(row(csvi(6))))
													str_cpic = ""
													For i = 0 To UBound(Split(cpic,";"))
															If InStr(Split(cpic,";")(i),":") > 0 Then 
																	str_cpic = str_cpic & "@@csv/"& Split(Split(cpic,";")(i),":")(0) &".jpg"
															End If 
													Next 
													inexcel("cpic") = str_cpic
													inexcel("pic") = "csv/"& Split(Split(cpic,";")(0),":")(0) &".jpg"
													inexcel("p_tags") = ""
													inexcel("buys") = 0
													inexcel("views") = 0
													inexcel("p_cx_sj") = 0
													inexcel("p_stj_sj") = 0
													inexcel("p_ytj_sj") = 0
													inexcel("p_chima") = ",,"
													inexcel("p_color") = ",,"
													inexcel("p_gongxiao") = ",,"
													inexcel("p_person") = ",,"
													inexcel("sj") = now()
													inexcel("p_filename") = safereplace(cvsDataList(1,ii))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													set getid = conn.execute("select top 1 id from [lebi_product] order by id desc")
													id = getid("id")
													getid.close:set getid=Nothing
													If safereplace(GetCsvValue(row(csvi(7)))) = "" Then 
															bianhao = date()
															bianhao = replace(bianhao, "-", "")
															bianhao = replace(bianhao, " ", "")
															bianhao = replace(bianhao, ":", "")
															bianhao = bianhao & id
															conn.execute "update [lebi_product] set bianhao='"& bianhao &"' where id=" & id&""
													End If 
													set rss = conn.execute("select grade_dj from [lebi_user_grade] where grade_dj <> 0 order by grade_dj asc")
													do while not rss.eof
															conn.execute("insert into [lebi_product_price] (product_id,grade_id,price)values("& id &","& rss(0) &","& checknum(GetCsvValue(row(csvi(2))),0) &")")
													rss.movenext
													loop
													rss.close:set rss = Nothing
													str_cpic = ""
													cpic = ""
											Else
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(4))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
															inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(4))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
													End If
													If GetCsvValue(row(csvi(1))) <> "" Then inexcel("bianhao") = safereplace(GetCsvValue(row(csvi(1))))
													inexcel("kucun") = checknum(GetCsvValue(row(csvi(3))),0)
													inexcel("sprice") = checknum(GetCsvValue(row(csvi(2))),0)
													inexcel("cbprice") = checknum(GetCsvValue(row(csvi(2))),0)
													inexcel("stj") = checknum(GetCsvValue(row(csvi(5))),0)
													inexcel("ytj") = checknum(GetCsvValue(row(csvi(5))),0)
													cpic = safereplace(GetCsvValue(row(csvi(6))))
													str_cpic = ""
													For i = 0 To UBound(Split(cpic,";"))
															If InStr(Split(cpic,";")(i),":") > 0 Then 
																	str_cpic = str_cpic & "@@csv/"& Split(Split(cpic,";")(i),":")(0) &".jpg"
															End If 
													Next 
													inexcel("cpic") = str_cpic
													inexcel("pic") = "csv/"& Split(Split(cpic,";")(0),":")(0) &".jpg"
													inexcel("sj") = now()
													If Null(inexcel("p_filename")) Or inexcel("p_filename") = "" Then inexcel("p_filename") = safereplace(cvsDataList(1,ii))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													For i = 0 To UBound(GradeData,2)
															conn.execute("update [lebi_product_price] set price="& checknum(GetCsvValue(row(csvi(2))),0) &" where product_id="& inexcel("id") &" and grade_id="& GradeData(0,i) &"")
													Next 
											End If 
											Else 
												delcsvNum = delcsvNum + 1
											End If 
									End If 
									csvNum = csvNum + 1
									Wend
									csvFile.Close
									Set csvFile = Nothing
									Set Fso = Nothing
									rem 删除导入的无效数据 by 56770.kingdge 2012-11-01
									conn.execute("delete from [lebi_product] where cbprice is null")
									Else 
									Set csvrs=csvconn.Execute("select * from "& file.filename &"")
									Do While Not csvrs.eof 
											if safereplace(csvrs("宝贝名称")) <> "" then 
											set inexcel = server.createobject("adodb.recordset")
											inexcelsql = "select * from [lebi_product] where"
											Select Case uptype
											Case "1" inexcelsql = inexcelsql &" product_name = '"& safereplace(csvrs("宝贝名称")) &"'"
											Case "2" inexcelsql = inexcelsql &" bianhao = '"& safereplace(csvrs("商家编码")) &"'"
											Case "3" inexcelsql = inexcelsql &" (product_name = '"& safereplace(csvrs("宝贝名称")) &"' and bianhao = '"& safereplace(csvrs("商家编码")) &"')"
											End Select 
											inexcel.open inexcelsql,conn,1,3
											If inexcel.eof Then 
													inexcel.addnew
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("宝贝名称"))
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("宝贝描述"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("宝贝名称"))
															inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("宝贝描述"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
													End If
													For LangT = 1 To TotalLang
															inexcel("brand" & LanguageTxt(LangT))=""
															inexcel("briefed" & LanguageTxt(LangT))=""
															inexcel("webhead" & LanguageTxt(LangT)) = "$$$$$$"
															inexcel("pro_name" & LanguageTxt(LangT)) = "$"
															inexcel("pro_info" & LanguageTxt(LangT)) = "$$$"
													Next
													inexcel("bianhao") = safereplace(csvrs("商家编码"))
													inexcel("kucun") = checknum(csvrs("宝贝数量"),0)
													inexcel("zhuangtai") = 1
													inexcel("sprice") = checknum(csvrs("宝贝价格"),0)
													inexcel("cbprice") = checknum(csvrs("宝贝价格"),0)
													inexcel("cx") = 0
													inexcel("cprice") = 0
													inexcel("stj") = checknum(csvrs("橱窗推荐"),0)
													inexcel("ytj") = checknum(csvrs("橱窗推荐"),0)
													inexcel("p_jifen") = 0
													inexcel("p_weight") = 0
													cpic = csvrs("新图片")
													str_cpic = ""
													For i = 0 To UBound(Split(cpic,";"))
															If InStr(Split(cpic,";")(i),":") > 0 Then 
																	str_cpic = str_cpic & "@@csv/"& Split(Split(cpic,";")(i),":")(0) &".jpg"
															End If 
													Next 
													inexcel("cpic") = str_cpic
													inexcel("pic") = "csv/"& Split(Split(cpic,";")(0),":")(0) &".jpg"
													inexcel("p_tags") = ""
													inexcel("buys") = 0
													inexcel("views") = 0
													inexcel("p_cx_sj") = 0
													inexcel("p_stj_sj") = 0
													inexcel("p_ytj_sj") = 0
													inexcel("p_chima") = ",,"
													inexcel("p_color") = ",,"
													inexcel("p_gongxiao") = ",,"
													inexcel("p_person") = ",,"
													inexcel("sj") = now()
													inexcel("p_filename") = safereplace(csvrs("商家编码"))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													set getid = conn.execute("select top 1 id from [lebi_product] order by id desc")
													id = getid("id")
													getid.close:set getid=Nothing
													If safereplace(csvrs("商家编码")) = "" Then 
															bianhao = date()
															bianhao = replace(bianhao, "-", "")
															bianhao = replace(bianhao, " ", "")
															bianhao = replace(bianhao, ":", "")
															bianhao = bianhao & id
															conn.execute "update [lebi_product] set bianhao='"& bianhao &"' where id=" & id&""
													End If 
													set rss = conn.execute("select grade_dj from [lebi_user_grade] where grade_dj <> 0 order by grade_dj asc")
													do while not rss.eof
															conn.execute("insert into [lebi_product_price] (product_id,grade_id,price)values("& id &","& rss(0) &","& checknum(csvrs("宝贝价格"),0) &")")
													rss.movenext
													loop
													rss.close:set rss = Nothing
											Else
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													response.write server.htmlencode(csvrs("宝贝描述"))
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("宝贝名称"))
																	If Not IsNull(csvrs("宝贝描述")) And csvrs("宝贝描述") <> "" Then 
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("宝贝描述"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																	End If 
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("宝贝名称"))
															If Not IsNull(csvrs("宝贝描述")) And csvrs("宝贝描述") <> "" Then 
															inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("宝贝描述"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															End If 
													End If
													inexcel("kucun") = checknum(csvrs("宝贝数量"),0)
													inexcel("sprice") = checknum(csvrs("宝贝价格"),0)
													inexcel("cbprice") = checknum(csvrs("宝贝价格"),0)
													inexcel("stj") = checknum(csvrs("橱窗推荐"),0)
													inexcel("ytj") = checknum(csvrs("橱窗推荐"),0)
													cpic = csvrs("新图片")
													str_cpic = ""
													For i = 0 To UBound(Split(cpic,";"))
															If InStr(Split(cpic,";")(i),":") > 0 Then 
																	str_cpic = str_cpic & "@@csv/"& Split(Split(cpic,";")(i),":")(0) &".jpg"
															End If 
													Next 
													inexcel("cpic") = str_cpic
													inexcel("pic") = "csv/"& Split(Split(cpic,";")(0),":")(0) &".jpg"
													inexcel("sj") = now()
													If IsNull(inexcel("p_filename")) Or inexcel("p_filename") = "" Then inexcel("p_filename") = safereplace(csvrs("商家编码"))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													For i = 0 To UBound(GradeData,2)
															conn.execute("update [lebi_product_price] set price="& checknum(csvrs("宝贝价格"),0) &" where product_id="& inexcel("id") &" and grade_id="& GradeData(0,i) &"")
													Next 
											End If 
											End If 
									csvrs.movenext 
									Loop
									csvrs.close : Set csvrs = Nothing 
									End If 
							   Case "3"
									If savecode = 1 Then 
									Set Fso = Server.CreateObject("Scripting.FileSystemObject")
									Set csvFile = Fso.OpenTextFile(Server.MapPath(Eshop_url & AdminPath &"/excel/"& file.filename),1,True,-1)
									csvNum = 0
									RowTitle = ""
									While Not csvFile.AtEndOfStream
									If csvNum = 0 Then
											row = Split(csvFile.ReadLine,"	")
											for i = 0 to ubound(row)
													csvVar=row(i)
													RowTitle = RowTitle & row(i)
													Select Case csvVar   
													Case "商品名称" csvi(0) = i    
													Case "商家编码" csvi(1) = i
													Case "图片" csvi(2) = i
													Case "图片2" csvi(3) = i
													Case "图片3" csvi(4) = i
													Case "图片4" csvi(5) = i
													Case "图片5" csvi(6) = i
													Case "商品详情" csvi(7) = i
													Case "商品数量" csvi(8) = i
													Case "上架选项" csvi(9) = i
													Case "价格" csvi(10) = i
													Case "橱窗" csvi(11) = i
													End Select
											next	
									End If
									row = Split(csvFile.ReadLine,"	")
									if safereplace(GetCsvValue(row(csvi(0)))) <> "" then 
											set inexcel = server.createobject("adodb.recordset")
											inexcelsql = "select * from [lebi_product] where"
											Select Case uptype
											Case "1" inexcelsql = inexcelsql &" product_name = '"& safereplace(GetCsvValue(row(csvi(0)))) &"'"
											Case "2" inexcelsql = inexcelsql &" bianhao = '"& safereplace(GetCsvValue(row(csvi(1)))) &"'"
											Case "3" inexcelsql = inexcelsql &" (product_name = '"& safereplace(GetCsvValue(row(csvi(0)))) &"' and bianhao = '"& safereplace(GetCsvValue(row(csvi(1)))) &"')"
											End Select 
											inexcel.open inexcelsql,conn,1,3
											If inexcel.eof Then 
													inexcel.addnew
													cpic = "csv/"& Trim(GetCsvValue(row(csvi(2))))
													If Trim(GetCsvValue(row(csvi(3)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(3))))
													End If 
													If Trim(GetCsvValue(row(csvi(4)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(4))))
													End If 
													If Trim(GetCsvValue(row(csvi(5)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(5))))
													End If 
													If Trim(GetCsvValue(row(csvi(6)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(6))))
													End If 
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
																	If Right(Trim(GetCsvValue(row(csvi(7)))),5) = "}.htm" Then 
																			if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7))))) Then
																					inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFileGb2312("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																					fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))))
																			End If 
																	Else 
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(7))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																	End If 
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
															If Right(Trim(GetCsvValue(row(csvi(7)))),5) = "}.htm" Then 
																	if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7))))) Then
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFileGb2312("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																			fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))))
																	End If 
															Else 
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(7))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															End If 
													End If
													For LangT = 1 To TotalLang
															inexcel("brand" & LanguageTxt(LangT))=""
															inexcel("briefed" & LanguageTxt(LangT))=""
															inexcel("webhead" & LanguageTxt(LangT)) = "$$$$$$"
															inexcel("pro_name" & LanguageTxt(LangT)) = "$"
															inexcel("pro_info" & LanguageTxt(LangT)) = "$$$"
													Next
													inexcel("p_filename") = safereplace(GetCsvValue(row(csvi(0))))
													inexcel("bianhao") = safereplace(GetCsvValue(row(csvi(1))))
													inexcel("kucun") = checknum(GetCsvValue(row(csvi(8))),0)
													inexcel("zhuangtai") = checknum(GetCsvValue(row(csvi(9))),1)
													inexcel("sprice") = checknum(GetCsvValue(row(csvi(10))),0)
													inexcel("cbprice") = checknum(GetCsvValue(row(csvi(10))),0)
													inexcel("cx") = 0
													inexcel("cprice") = 0
													inexcel("stj") = checknum(GetCsvValue(row(csvi(11))),0)
													inexcel("ytj") = checknum(GetCsvValue(row(csvi(11))),0)
													inexcel("p_jifen") = 0
													inexcel("p_weight") = 0
													inexcel("pic") = "csv/"& safereplace(GetCsvValue(row(csvi(2))))
													inexcel("cpic") = safereplace(cpic)
													inexcel("p_tags") = ""
													inexcel("p_cx_sj") = 0
													inexcel("p_stj_sj") = 0
													inexcel("p_ytj_sj") = 0
													inexcel("p_chima") = ",,"
													inexcel("p_color") = ",,"
													inexcel("p_gongxiao") = ",,"
													inexcel("p_person") = ",,"
													inexcel("sj") = now()
													inexcel("p_filename") = safereplace(GetCsvValue(row(csvi(1))))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													set getid = conn.execute("select top 1 id from [lebi_product] order by id desc")
													id = getid("id")
													getid.close:set getid=Nothing
													If safereplace(GetCsvValue(row(csvi(1)))) = "" Then 
															bianhao = date()
															bianhao = replace(bianhao, "-", "")
															bianhao = replace(bianhao, " ", "")
															bianhao = replace(bianhao, ":", "")
															bianhao = bianhao & id
															conn.execute "update [lebi_product] set bianhao='"& bianhao &"' where id=" & id&""
													End If 
													set rss = conn.execute("select grade_dj from [lebi_user_grade] where grade_dj <> 0 order by grade_dj asc")
													do while not rss.eof
															conn.execute("insert into [lebi_product_price] (product_id,grade_id,price)values("& id &","& rss(0) &","& checknum(GetCsvValue(row(csvi(10))),0) &")")
													rss.movenext
													loop
													rss.close:set rss = Nothing
											Else
													cpic = "csv/"& Trim(GetCsvValue(row(csvi(2))))
													If Trim(GetCsvValue(row(csvi(3)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(3))))
													End If 
													If Trim(GetCsvValue(row(csvi(4)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(4))))
													End If 
													If Trim(GetCsvValue(row(csvi(5)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(5))))
													End If 
													If Trim(GetCsvValue(row(csvi(6)))) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(GetCsvValue(row(csvi(6))))
													End If 
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
																	If Right(Trim(GetCsvValue(row(csvi(7)))),5) = "}.htm" Then 
																			if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7))))) Then
																					inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFileGb2312("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																					fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))))
																			End If 
																	Else 
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(7))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
'	
																	End If 
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(GetCsvValue(row(csvi(0))))
															If Right(Trim(GetCsvValue(row(csvi(7)))),5) = "}.htm" Then 
																	if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7))))) Then
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFileGb2312("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																			fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& GetCsvValue(row(csvi(7)))))
																	End If 
															Else 
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(GetCsvValue(row(csvi(7))),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															End If 
													End If
													inexcel("kucun") = checknum(GetCsvValue(row(csvi(8))),0)
													inexcel("zhuangtai") = checknum(GetCsvValue(row(csvi(9))),1)
													inexcel("sprice") = checknum(GetCsvValue(row(csvi(10))),0)
													inexcel("cbprice") = checknum(GetCsvValue(row(csvi(10))),0)
													inexcel("stj") = checknum(GetCsvValue(row(csvi(11))),0)
													inexcel("ytj") = checknum(GetCsvValue(row(csvi(11))),0)
													inexcel("pic") = "csv/"& safereplace(GetCsvValue(row(csvi(2))))
													inexcel("cpic") = safereplace(cpic)
													inexcel("sj") = now()
													If Null(inexcel("p_filename")) Or inexcel("p_filename") = "" Then inexcel("p_filename") = safereplace(GetCsvValue(row(csvi(1))))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													For i = 0 To UBound(GradeData,2)
															conn.execute("update [lebi_product_price] set price="& checknum(GetCsvValue(row(csvi(10))),0) &" where product_id="& inexcel("id") &" and grade_id="& GradeData(0,i) &"")
													Next 
											End If
									End If 
									csvNum = csvNum + 1
									Wend
									csvFile.Close
									Set csvFile = Nothing
									Set Fso = Nothing
									Else 
									Set csvrs=csvconn.Execute("select * from "& file.filename &"")
									Do While Not csvrs.eof 
											if safereplace(csvrs("商品名称")) <> "" then 
											set inexcel = server.createobject("adodb.recordset")
											inexcelsql = "select * from [lebi_product] where"
											Select Case uptype
											Case "1" inexcelsql = inexcelsql &" product_name = '"& safereplace(csvrs("商品名称")) &"'"
											Case "2" inexcelsql = inexcelsql &" bianhao = '"& safereplace(csvrs("商家编码")) &"'"
											Case "3" inexcelsql = inexcelsql &" (product_name = '"& safereplace(csvrs("商品名称")) &"' and bianhao = '"& safereplace(csvrs("商家编码")) &"')"
											End Select 
											inexcel.open inexcelsql,conn,1,3
											If inexcel.eof Then 
													inexcel.addnew
													cpic = "csv/"& Trim(csvrs("图片"))
													If Trim(csvrs("图片2")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片2"))
													End If 
													If Trim(csvrs("图片3")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片3"))
													End If 
													If Trim(csvrs("图片4")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片4"))
													End If 
													If Trim(csvrs("图片5")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片5"))
													End If 
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("商品名称"))
																	If Right(Trim(csvrs("商品详情")),5) = "}.htm" Then 
																			if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情"))) Then
																					inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFile("../"& picpath &"/csv/"& csvrs("商品详情")),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																			fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情")))
																			End If 
																	Else 
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("商品详情"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																	End If 
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("商品名称"))
															If Right(Trim(csvrs("商品详情")),5) = "}.htm" Then 
																	if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情"))) Then
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFile("../"& picpath &"/csv/"& csvrs("商品详情")),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																			fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情")))
																	End If 
															Else 
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("商品详情"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															End If 
													End If
													For LangT = 1 To TotalLang
															inexcel("brand" & LanguageTxt(LangT))=""
															inexcel("briefed" & LanguageTxt(LangT))=""
															inexcel("webhead" & LanguageTxt(LangT)) = "$$$$$$"
															inexcel("pro_name" & LanguageTxt(LangT)) = "$"
															inexcel("pro_info" & LanguageTxt(LangT)) = "$$$"
													Next
													inexcel("bianhao") = safereplace(csvrs("商家编码"))
													inexcel("kucun") = checknum(csvrs("商品数量"),0)
													inexcel("zhuangtai") = checknum(csvrs("上架选项"),1)
													inexcel("sprice") = checknum(csvrs("价格"),0)
													inexcel("cbprice") = checknum(csvrs("价格"),0)
													inexcel("cx") = 0
													inexcel("cprice") = 0
													inexcel("stj") = checknum(csvrs("橱窗"),0)
													inexcel("ytj") = checknum(csvrs("橱窗"),0)
													inexcel("p_jifen") = 0
													inexcel("p_weight") = 0
													inexcel("pic") = "csv/"& safereplace(csvrs("图片"))
													inexcel("cpic") = safereplace(cpic)
													inexcel("p_tags") = ""
													inexcel("p_cx_sj") = 0
													inexcel("p_stj_sj") = 0
													inexcel("p_ytj_sj") = 0
													inexcel("p_chima") = ",,"
													inexcel("p_color") = ",,"
													inexcel("p_gongxiao") = ",,"
													inexcel("p_person") = ",,"
													inexcel("sj") = now()
													inexcel("p_filename") = safereplace(csvrs("商家编码"))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													set getid = conn.execute("select top 1 id from [lebi_product] order by id desc")
													id = getid("id")
													getid.close:set getid=Nothing
													If safereplace(csvrs("商家编码")) = "" Then 
															bianhao = date()
															bianhao = replace(bianhao, "-", "")
															bianhao = replace(bianhao, " ", "")
															bianhao = replace(bianhao, ":", "")
															bianhao = bianhao & id
															conn.execute "update [lebi_product] set bianhao='"& bianhao &"' where id=" & id&""
													End If 
													set rss = conn.execute("select grade_dj from [lebi_user_grade] where grade_dj <> 0 order by grade_dj asc")
													do while not rss.eof
															conn.execute("insert into [lebi_product_price] (product_id,grade_id,price)values("& id &","& rss(0) &","& checknum(csvrs("价格"),0) &")")
													rss.movenext
													loop
													rss.close:set rss = Nothing
											Else
													cpic = "csv/"& Trim(csvrs("图片"))
													If Trim(csvrs("图片2")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片2"))
													End If 
													If Trim(csvrs("图片3")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片3"))
													End If 
													If Trim(csvrs("图片4")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片4"))
													End If 
													If Trim(csvrs("图片5")) <> "" Then 
															cpic = cpic & "@@csv/"& Trim(csvrs("图片5"))
													End If 
													If categoryid <> "" Then 
															inexcel("categoryid") = ","& categoryid &","
													End If 
													If LangT = 999 Then
															For LangT = 1 To TotalLang
																	inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("商品名称"))
																	If Right(Trim(csvrs("商品详情")),5) = "}.htm" Then 
																			if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情"))) Then
																					inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFile("../"& picpath &"/csv/"& csvrs("商品详情")),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																					fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情")))
																			End If 
																	Else 
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("商品详情"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																	End If 
															Next
													Else
															inexcel("product_name" & LanguageTxt(LangT))=safereplace(csvrs("商品名称"))
															If Right(Trim(csvrs("商品详情")),5) = "}.htm" Then 
																	if fso.fileexists(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情"))) Then
																			inexcel("details" & LanguageTxt(LangT))=Replace(Replace(LoadFile("../"& picpath &"/csv/"& csvrs("商品详情")),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
																			fso.DeleteFile(Server.MapPath("../"& picpath &"/csv/"& csvrs("商品详情")))
																	End If 
															Else 
																	inexcel("details" & LanguageTxt(LangT))=Replace(Replace(csvrs("商品详情"),"'","&#180;"),Chr(34) & Chr(34),Chr(34))
															End If 
													End If
													inexcel("kucun") = checknum(csvrs("商品数量"),0)
													inexcel("zhuangtai") = checknum(csvrs("上架选项"),1)
													inexcel("sprice") = checknum(csvrs("价格"),0)
													inexcel("cbprice") = checknum(csvrs("价格"),0)
													inexcel("stj") = checknum(csvrs("橱窗"),0)
													inexcel("ytj") = checknum(csvrs("橱窗"),0)
													inexcel("pic") = "csv/"& safereplace(csvrs("图片"))
													inexcel("cpic") = safereplace(cpic)
													inexcel("sj") = now()
													If Null(inexcel("p_filename")) Or inexcel("p_filename") = "" Then inexcel("p_filename") = safereplace(csvrs("商家编码"))
													If savetype = 1 Then inexcel("html") = 2
													inexcel.update
													For i = 0 To UBound(GradeData,2)
															conn.execute("update [lebi_product_price] set price="& checknum(csvrs("价格"),0) &" where product_id="& inexcel("id") &" and grade_id="& GradeData(0,i) &"")
													Next 
											End If
											End If 
									csvrs.movenext 
									Loop
									csvrs.close : Set csvrs = Nothing 
									End If 
						End Select
						Call DelFile(f_filename)
						If Config_Lebi_Eshop(17)="1" Then
								Application.Contents.RemoveAll
						Else
								NewEvent "0"
						End If
						If filetype = 1 Or (filetype = 2 And savecode = 0) Or (filetype = 3 And savecode = 0) Then 
								csvNum = Ubound(cvsDataList,2)+1
								csvConn.close
						End If 
						managelog Replace(Lang_Product(147),"[num]",csvNum)
						If savetype = 1 Then
								url = "?action=saveremotefile"
						Else
								url = "?datatype=2"
						End If 
						call up_mes(Lang_Menu(69),"·"& Replace(Lang_Product(147),"[num]",csvNum - delcsvNum),0,url,0,0,2,1)
				Next
		Else
				call up_mes(Lang_sys(46),"·"& Lang_Product(148),0,"javascript:history.back()",0,0,2,0)
		end If
		set upload_56770 = Nothing
		Response.Write("</div>")
		Response.Write("</div>")
		Response.Write("<script>$(""#divposting"").hide();</script>")
		LB_Footer()
end Sub

sub lead()
	    server.scripttimeout=9999999
		Dim filetype,filename,categoryid,sql,rs
		leadtemplate = checknum(request("leadtemplate"),0)
		filetype = request("filetype")
		LangTxt = safereplace(request("LangTxt"))
		categoryid = safereplace(request.Form("categoryid"))
		startid = checknum(request.Form("startid"),0)
		endid = checknum(request.Form("endid"),0)
		item1 = safereplace(request.Form("item1"))
		item2 = safereplace(request.Form("item2"))
		item3 = checknum(request.Form("item3"),0)
		item4 = checknum(request.Form("item4"),0)
		item5 = checknum(request.Form("item5"),0)
		item6 = checknum(request.Form("item6"),0)
		Select Case filetype
			   Case "1" filename = "../csv/"& Trim(request("filename")) &".csv"
			   Case "2" filename = "../csv/"& Trim(request("filename")) &"/"& Trim(request.Form("filename")) &".csv"
			   Case "3" filename = "../csv/"& Trim(request("filename")) &"/"& Trim(request.Form("filename")) &".csv"
			   Case "4" filename = "../csv/"& Trim(request("filename")) &".xls"
			   Case "5" filename = "../csv/"& Trim(request("filename")) &".txt"
		End Select
		If leadtemplate = 0 Then 
				LB_Head()
				LB_Menu()
				If OnlyRead = 1 Then OnlyReadMessage()
				sql = "select id from [Lebi_Product] where id>="& startid &" and id<="& Endid &""
				If categoryid <> "0" Then 
						If IsSqlDataBase = 1 Then sql=sql + " and charindex(',"& categoryid &",',categoryid)>0"
						If IsSqlDataBase = 0 Then sql=sql + " and instr(categoryid,',"& categoryid &",')>0"
				End If 
				Set rs = server.CreateObject("adodb.recordset")
				rs.open sql,conn,1,1
				If rs.eof Then
						LB_Head()
						LB_Menu()
						%>
						<div class="tabmenu mainwidth">
							  <ul>
								<li class="current"><a href="?datatype=1"><span><%=Lang_Product(156)%></span></a></li>
								<li><a href="?datatype=2"><span><%=Lang_Product(157)%></span></a></li>
							  </ul>
						</div>
						<%
						Response.Write("<div class=""tab-mainbody"">")
						Response.Write("<div class=""tab-mainbody2"">")
						call up_mes(Lang_sys(46),"·"& Lang_Product(149),0,"javascript:history.back()",0,0,2,0)
						Response.Write("</div>")
						Response.Write("</div>")
						LB_Footer()
				Else
						TotalNum = rs.recordcount
				End If
				rs.close()
		End If 
		Select Case filetype
			   Case "1"
					Temp="*"& Lang_Product(102) &",*"& Lang_Product(101) &","& Lang_Product(191) &",*"& Lang_Product(104) &","& Lang_Product(192) &",*"& Lang_Product(119) &","& Lang_Product(103)
					sql="select grade_dj,price_txt"& LangTxt &" from [Lebi_user_grade] where grade_dj <> 0 order by grade_dj"
					set rs = conn.execute(sql)
					If Not rs.eof Then 
							GradeData = rs.getrows()
					End If 
					rs.close:Set rs = Nothing
					For i = 0 To UBound(GradeData,2)
							Temp=Temp&",*"& GradeData(1,i)
					Next 
					Temp=Temp&",*"& Lang_Product(194) &",*"& Lang_Product(120) &",*"& Lang_Product(195) &",*"& Lang_Product(196) &",*"& Lang_Product(197) &",*"& Lang_Product(198) &",*"& Lang_Product(199) &",*"& Lang_Product(201) &","& Lang_Product(219) &","& Lang_Product(220) &","& Lang_Product(202) &","& Lang_Product(239) &","& Lang_Product(240)
					For LangT = 2 To TotalLang
							Temp=Temp&",*"& Lang_Product(101) &"("& LanguageName(LangT) &"),"& Lang_Product(191) &"("& LanguageName(LangT) &"),"& Lang_Product(219) &"("& LanguageName(LangT) &"),"& Lang_Product(220) &"("& LanguageName(LangT) &"),"& Lang_Product(239) &"("& LanguageName(LangT) &"),"& Lang_Product(240) &"("& LanguageName(LangT) &")"
					Next 
					Temp=Temp&","& Lang_Product(118) & vbcrlf
					TempNum=1
					If leadtemplate = 0 Then 
							sql = "select id,bianhao,product_name"& LangTxt &",brand"& LangTxt &",kucun,zhuangtai,sprice,cbprice,cx,cprice,stj,ytj,p_jifen,p_weight,pic,cpic,briefed"& LangTxt &",details"& LangTxt &",p_tags,pro_name"& LangTxt &",pro_info"& LangTxt &""
							For LangT = 2 To TotalLang
									sql = sql &",product_name"& LanguageTxt(LangT) &",brand"& LanguageTxt(LangT) &",briefed"& LanguageTxt(LangT) &",details"& LanguageTxt(LangT) &",pro_name"& LanguageTxt(LangT) &",pro_info"& LanguageTxt(LangT)
							Next 
							sql = sql &",p_order from [Lebi_Product] where id>="& startid &" and id<="& Endid &""
							If categoryid <> "0" Then 
									If IsSqlDataBase = 1 Then sql=sql + " and charindex(',"& categoryid &",',categoryid)>0"
									If IsSqlDataBase = 0 Then sql=sql + " and instr(categoryid,',"& categoryid &",')>0"
							End If 
							Set rs = server.CreateObject("adodb.recordset")
							rs.open sql,conn,1,1
							Do While Not rs.eof
								Temp=Temp&ToCsv(rs(1))&","
								Temp=Temp&ToCsv(rs(2))&","
								Temp=Temp&ToCsv(rs(3))&","
								Temp=Temp&ToCsv(rs(4))&","
								Temp=Temp&ToCsv(rs(5))&","
								Temp=Temp&ToCsv(rs(6))&","
								Temp=Temp&ToCsv(rs(7))&","
								For i = 0 To UBound(GradeData,2)
								Set rss = conn.execute("Select price from [Lebi_Product_price] where product_id = "& rs(0) &" and grade_id = "& GradeData(0,i) &"")
								If Not rss.eof Then
										Temp=Temp&ToCsv(rss(0))&","
								Else
										Temp=Temp&"0,"
								End If 
								rss.close
								Next 
								Temp=Temp&ToCsv(rs(8))&","
								Temp=Temp&ToCsv(rs(9))&","
								Temp=Temp&ToCsv(rs(10))&","
								Temp=Temp&ToCsv(rs(11))&","
								Temp=Temp&ToCsv(rs(12))&","
								Temp=Temp&ToCsv(rs(13))&","
								Temp=Temp&ToCsv(rs(14))&","
								Temp=Temp&ToCsv(rs(15))&","
								Temp=Temp&ToCsv(rs(16))&","
								Temp=Temp&ToCsv(rs(17))&","
								Temp=Temp&ToCsv(rs(18))&","
								Temp=Temp&ToCsv(rs(19))&","
								Temp=Temp&ToCsv(rs(20))&","
								For LangT = 2 To TotalLang
										Temp=Temp&ToCsv(rs("product_name"& LanguageTxt(LangT)))&","
										Temp=Temp&ToCsv(rs("brand"& LanguageTxt(LangT)))&","
										Temp=Temp&ToCsv(rs("briefed"& LanguageTxt(LangT)))&","
										Temp=Temp&ToCsv(rs("details"& LanguageTxt(LangT)))&","
										Temp=Temp&ToCsv(rs("pro_name"& LanguageTxt(LangT)))&","
										Temp=Temp&ToCsv(rs("pro_info"& LanguageTxt(LangT)))&","
								Next 
								Temp=Temp&rs("p_order")&vbcrlf
								TempNum=TempNum+1
							rs.movenext
							Loop
					End If 
					Savehtml "../csv/"& filename,Temp
			   Case "2"
					createpath("../csv/"& Trim(request.Form("filename")) &"/")
					createpath("../csv/"& Trim(request.Form("filename")) &"/images/")
					Temp="宝贝名称,宝贝类目,店铺类目,新旧程度,省,城市,出售方式,宝贝价格,加价幅度,宝贝数量,有效期,运费承担,平邮,EMS,快递,付款方式,支付宝,发票,保修,自动重发,放入仓库,橱窗推荐,发布时间,心情故事,宝贝描述,宝贝属性,团购价,最小团购件数,邮费模版ID,会员打折,修改时间,上传状态,图片状态,返点比例,新图片,销售属性组合,用户输入ID串,用户输入名-值对,商家编码,销售属性别名"&vbcrlf
					TempNum=1
					sql = "select product_name"& LangTxt &",kucun,details"& LangTxt &",cpic,s.price as buyprice from [Lebi_Product] as p,[Lebi_product_price] as s where p.id>="& startid &" and p.id<="& Endid &" and s.product_id=p.id and s.grade_id=1"
					If categoryid <> "0" Then 
							If IsSqlDataBase = 1 Then sql=sql + " and charindex(',"& categoryid &",',categoryid)>0"
							If IsSqlDataBase = 0 Then sql=sql + " and instr(categoryid,',"& categoryid &",')>0"
					End If 
					Set rs = server.CreateObject("adodb.recordset")
					rs.open sql,conn,1,1
					Do While Not rs.eof
						Temp=Temp&ToCsv(rs(0))&","
						Temp=Temp&"0"&","
						Temp=Temp&"0"&","
						Temp=Temp&"0"&","
						Temp=Temp&item1&","
						Temp=Temp&item2&","
						Temp=Temp&"b"&","
						Temp=Temp&ToCsv(rs(4))&","
						Temp=Temp&"0"&","
						Temp=Temp&ToCsv(rs(1))&","
						Temp=Temp&"7"&","
						Temp=Temp&item3&","
						Temp=Temp&item4&","
						Temp=Temp&item5&","
						Temp=Temp&item6&","
						Temp=Temp&"0"&","
						Temp=Temp&"1"&","
						Temp=Temp&"0"&","
						Temp=Temp&"0"&","
						Temp=Temp&"1"&","
						Temp=Temp&"-2"&","
						Temp=Temp&"0"&","
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&ToCsv(ReplaceRemoteUrl(rs(2)))&","
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&"0"&","
						Temp=Temp&"0"&","
						Temp=Temp&""&","
						Temp=Temp&"200"&","
						Temp=Temp&""&","
						Temp=Temp&"0"&","
						If Instr(rs(3),"@@") > 0 Then 
								cpic = ""
								For p = 1 To UBound(Split(rs(3),"@@"))
										cpic = cpic & ChangeToTbi(Split(rs(3),"@@")(p))&":0:"& p - 1 &":|;"
										Call CopyFiles(server.mappath("../"& picpath &"/"& Split(rs(3),"@@")(p)),server.mappath("../csv/"& Trim(request.Form("filename")) &"/images/"& ChangeToTbi(Split(rs(3),"@@")(p)) &".tbi"))
								Next 
								Temp=Temp&ToCsv(cpic)&","
						Else 
								Temp=Temp&ToCsv(ChangeToTbi(rs(3)))&":0:0:|;,"
								Call CopyFiles(server.mappath("../"& picpath &"/"& rs(3)),server.mappath("../csv/"& Trim(request.Form("filename")) &"/images/"& ChangeToTbi(rs(3)) &".tbi"))
						End If 
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&""&vbcrlf
						TempNum=TempNum+1
					rs.movenext
					Loop
					rs.close : Set rs = Nothing
					Savehtml filename,Temp
					Set objTar = New Tarball
					objTar.TarFilename= "../"& Trim(request.Form("filename")) &".rar"
					objTar.Path="../csv/"& Trim(request.Form("filename"))
					objtar.pack(1)
					set objtar=Nothing
			   Case "3"
					createpath("../csv/"& Trim(request.Form("filename")) &"/")
					createpath("../csv/"& Trim(request.Form("filename")) &"/"& Trim(request.Form("filename")) &"/")
					Temp="id,商品名称,出售方式,商品类目,店铺类目,商品数量,商品重量,有效期,定时上架,新旧程度,价格,加价幅度,省,市,运费承担,平邮,快递,EMS,购买限制,付款方式,有发票,有保修,支持财付通,自动重发,错误原因,图片,图片2,图片3,图片4,图片5,商品详情,上架选项,皮肤风格,属性,诚保,假一陪三,橱窗,库存属性,产品ID,商家编码"&vbcrlf
					TempNum=1
					sql = "select product_name"& LangTxt &",kucun,details"& LangTxt &",cpic,s.price as buyprice,p.p_weight,p.id,p.bianhao from [Lebi_Product] as p,[Lebi_product_price] as s where p.id>="& startid &" and p.id<="& Endid &" and s.product_id=p.id and s.grade_id=1"
					If categoryid <> "0" Then 
							If IsSqlDataBase = 1 Then sql=sql + " and charindex(',"& categoryid &",',categoryid)>0"
							If IsSqlDataBase = 0 Then sql=sql + " and instr(categoryid,',"& categoryid &",')>0"
					End If 
					Set rs = server.CreateObject("adodb.recordset")
					rs.open sql,conn,1,1
					Do While Not rs.eof
						Temp=Temp&"-1"&","
						Temp=Temp&ToCsv(rs(0))&","
						Temp=Temp&"1"&","
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&rs(1)&","
						Temp=Temp&rs(5)&","
						Temp=Temp&"7"&","
						Temp=Temp&"1900-1-1  00:00:00"&","
						Temp=Temp&"1"&","
						Temp=Temp&rs(4)&","
						Temp=Temp&"0"&","
						Temp=Temp&item1&","
						Temp=Temp&item2&","
						Temp=Temp&item3&","
						Temp=Temp&item4&","
						Temp=Temp&item6&","
						Temp=Temp&item5&","
						Temp=Temp&"0"&","
						Temp=Temp&"0"&","
						Temp=Temp&"2"&","
						Temp=Temp&"2"&","
						Temp=Temp&"1"&","
						Temp=Temp&"1"&","
						Temp=Temp&""&","
						If Instr(rs(3),"@@") > 0 Then 
								cpic = ""
								picnum = UBound(Split(rs(3),"@@"))
								If picnum > 5 Then picnum = 5
								For p = 1 To picnum
										Temp=Temp&ToCsv(ChangeToPP(Split(rs(3),"@@")(p)))&","
										Call CopyFiles(server.mappath("../"& picpath &"/"& Split(rs(3),"@@")(p)),server.mappath("../csv/"& Trim(request.Form("filename")) &"/"& Trim(request.Form("filename")) &"/"& ChangeToPP(Split(rs(3),"@@")(p))))
								Next 
								If picnum = 1 Then 
										Temp=Temp&""&","
										Temp=Temp&""&","
										Temp=Temp&""&","
										Temp=Temp&""&","
								End If 
								If picnum = 2 Then 
										Temp=Temp&""&","
										Temp=Temp&""&","
										Temp=Temp&""&","
								End If 
								If picnum = 3 Then 
										Temp=Temp&""&","
										Temp=Temp&""&","
								End If 
								If picnum = 4 Then 
										Temp=Temp&""&","
								End If 
						Else 
								Temp=Temp&ToCsv(ChangeToPP(rs(3)))&","
								Call CopyFiles(server.mappath("../"& picpath &"/"& rs(3)),server.mappath("../csv/"& Trim(request.Form("filename")) &"/"& Trim(request.Form("filename")) &"/"& ChangeToPP(rs(3)) &""))
								Temp=Temp&""&","
								Temp=Temp&""&","
								Temp=Temp&""&","
								Temp=Temp&""&","
						End If 
						Temp=Temp&ToCsv(rs(6)&".htm")&","
						SavehtmlGb2312 "../csv/"& Trim(request.Form("filename")) &"/"& Trim(request.Form("filename")) &"/"& rs(6)&".htm",rs(2)
						Temp=Temp&"1"&","
						Temp=Temp&"0"&","
						Temp=Temp&""&","
						Temp=Temp&"1"&","
						Temp=Temp&"0"&","
						Temp=Temp&"0"&","
						Temp=Temp&""&","
						Temp=Temp&""&","
						Temp=Temp&ToCsv(rs(7))&vbcrlf
						TempNum=TempNum+1
					rs.movenext
					Loop
					rs.close : Set rs = Nothing
					Savehtml filename,Temp
					Set objTar = New Tarball
					objTar.TarFilename= "../"& Trim(request.Form("filename")) &".rar"
					objTar.Path="../csv/"& Trim(request.Form("filename"))
					objtar.pack(1)
					set objtar=Nothing
			   Case "4"
					Temp="<head><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"" /><style>td{vnd.ms-excel.numberformat:@}</style></head><table width=""100%"" border=""1""><tr><th filter=all>*"& Lang_Product(102) &"</th><th filter=all>*"& Lang_Product(101) &"</th><th filter=all>"& Lang_Product(191) &"</th><th filter=all>*"& Lang_Product(104) &"</th><th filter=all>"& Lang_Product(192) &"</th><th filter=all>*"& Lang_Product(119) &"</th><th filter=all>*"& Lang_Product(103) &"</th><th filter=all>*"& Lang_Product(193) &"</th><th filter=all>*"& Lang_Product(194) &"</th><th filter=all>*"& Lang_Product(120) &"</th><th filter=all>*"& Lang_Product(195) &"</th><th filter=all>*"& Lang_Product(196) &"</th><th filter=all>*"& Lang_Product(197) &"</th><th filter=all>*"& Lang_Product(198) &"</th><th filter=all>*"& Lang_Product(199) &"</th><th filter=all>*"& Lang_Product(201) &"</th><th filter=all>"& Lang_Product(219) &"</th><th filter=all>"& Lang_Product(220) &"</th><th filter=all>"& Lang_Product(202) &"</th><th filter=all>"& Lang_Product(239) &"</th><th filter=all>"& Lang_Product(240) &"</th></tr>"&vbcrlf
					TempNum=1
					sql = "select id,bianhao,product_name"& LangTxt &",brand"& LangTxt &",kucun,zhuangtai,sprice,cbprice,cx,cprice,stj,ytj,p_jifen,p_weight,pic,cpic,briefed"& LangTxt &",details"& LangTxt &",p_tags,pro_name"& LangTxt &",pro_info"& LangTxt &" from [Lebi_Product] where id>="& startid &" and id<="& Endid &""
					If categoryid <> "0" Then 
							If IsSqlDataBase = 1 Then sql=sql + " and charindex(',"& categoryid &",',categoryid)>0"
							If IsSqlDataBase = 0 Then sql=sql + " and instr(categoryid,',"& categoryid &",')>0"
					End If 
					Set rs = server.CreateObject("adodb.recordset")
					rs.open sql,conn,1,1
					Do While Not rs.eof
						Temp=Temp&"<tr>"
						Temp=Temp&"<td>"&rs(1)&"</td>"
						Temp=Temp&"<td>"&rs(2)&"</td>"
						Temp=Temp&"<td>"&rs(3)&"</td>"
						Temp=Temp&"<td>"&rs(4)&"</td>"
						Temp=Temp&"<td>"&rs(5)&"</td>"
						Temp=Temp&"<td>"&rs(6)&"</td>"
						Temp=Temp&"<td>"&rs(7)&"</td>"
						Temp=Temp&"<td>"&GetPriceArr(rs(0))&"</td>"
						Temp=Temp&"<td>"&rs(8)&"</td>"
						Temp=Temp&"<td>"&rs(9)&"</td>"
						Temp=Temp&"<td>"&rs(10)&"</td>"
						Temp=Temp&"<td>"&rs(11)&"</td>"
						Temp=Temp&"<td>"&rs(12)&"</td>"
						Temp=Temp&"<td>"&rs(13)&"</td>"
						Temp=Temp&"<td>"&rs(14)&"</td>"
						Temp=Temp&"<td>"&rs(15)&"</td>"
						Temp=Temp&"<td>"&rs(16)&"</td>"
						Temp=Temp&"<td>"
						If Not IsNull(rs(17)) Then 
							Temp=Temp&server.htmlencode(rs(17))
						End If 
						Temp=Temp&"</td>"
						Temp=Temp&"<td>"&rs(18)&"</td>"
						Temp=Temp&"<td>"&rs(19)&"</td>"
						Temp=Temp&"<td>"&rs(20)&"</td></tr>"
						TempNum=TempNum+1
					rs.movenext
					Loop
					Temp=Temp&"</table>"
					Savehtml "../csv/"& filename,Temp
			   Case "5"
					Temp=""& Lang_Product(102) &""&chr(9)&""& Lang_Product(101) &""&chr(9)&""& Lang_Product(191) &""&chr(9)&""& Lang_Product(104) &""&chr(9)&""& Lang_Product(192) &""&chr(9)&""& Lang_Product(119) &""&chr(9)&""& Lang_Product(103) &""&chr(9)&""& Lang_Product(193) &""&chr(9)&""& Lang_Product(194) &""&chr(9)&""& Lang_Product(120) &""&chr(9)&""& Lang_Product(195) &""&chr(9)&""& Lang_Product(196) &""&chr(9)&""& Lang_Product(197) &""&chr(9)&""& Lang_Product(198) &""&chr(9)&""& Lang_Product(199) &""&chr(9)&""& Lang_Product(201) &""&chr(9)&""& Lang_Product(202) &""&chr(9)&""& Lang_Product(239) &""&chr(9)&""& Lang_Product(240) &""&vbcrlf
					TempNum=1
					sql = "select id,bianhao,product_name"& LangTxt &",brand"& LangTxt &",kucun,zhuangtai,sprice,cbprice,cx,cprice,stj,ytj,p_jifen,p_weight,pic,cpic,briefed"& LangTxt &",details"& LangTxt &",p_tags,pro_name"& LangTxt &",pro_info"& LangTxt &" from [Lebi_Product] where id>="& startid &" and id<="& Endid &""
					If categoryid <> "0" Then 
							If IsSqlDataBase = 1 Then sql=sql + " and charindex(',"& categoryid &",',categoryid)>0"
							If IsSqlDataBase = 0 Then sql=sql + " and instr(categoryid,',"& categoryid &",')>0"
					End If 
					Set rs = server.CreateObject("adodb.recordset")
					rs.open sql,conn,1,1
					Do While Not rs.eof
						Temp=Temp&rs(1)&chr(9)
						Temp=Temp&rs(2)&chr(9)
						Temp=Temp&rs(3)&chr(9)
						Temp=Temp&rs(4)&chr(9)
						Temp=Temp&rs(5)&chr(9)
						Temp=Temp&rs(6)&chr(9)
						Temp=Temp&rs(7)&chr(9)
						Temp=Temp&GetPriceArr(rs(0))&chr(9)
						Temp=Temp&rs(8)&chr(9)
						Temp=Temp&rs(9)&chr(9)
						Temp=Temp&rs(10)&chr(9)
						Temp=Temp&rs(11)&chr(9)
						Temp=Temp&rs(12)&chr(9)
						Temp=Temp&rs(13)&chr(9)
						Temp=Temp&rs(14)&chr(9)
						Temp=Temp&rs(15)&chr(9)
						Temp=Temp&rs(18)&chr(9)
						Temp=Temp&rs(19)&chr(9)
						Temp=Temp&rs(20)&vbcrlf
						TempNum=TempNum+1
					rs.movenext
					Loop
					Savehtml "../csv/"& filename,Temp
		End Select
		LB_Head()
		LB_Menu()
		%>
		<div class="tabmenu mainwidth">
			  <ul>
				<li class="current"><a href="?datatype=1"><span><%=Lang_Product(156)%></span></a></li>
				<li><a href="?datatype=2"><span><%=Lang_Product(157)%></span></a></li>
			  </ul>
		</div>
		<%
		Response.Write("<script>$(""#divposting"").hide();</script>")
		If filetype = "2" Or filetype = "3" Then 
					filename = "../csv/"& Trim(request.Form("filename")) &".rar"
		End If 
		Response.Write("<div class=""tab-mainbody"">")
		Response.Write("<div class=""tab-mainbody2"">")
		If leadtemplate = 0 Then 
				m_s="·"& Replace(Lang_Product(150),"[num]",TotalNum)
		End If 
		call up_mes(Lang_Menu(69),m_s,0,"?datatype=1&file="& server.urlencode(filename) &"",0,0,3,1)
		Response.Write("</div>")
		Response.Write("</div>")
		LB_Footer()
end Sub

Sub down()
		filename = request.querystring("filename")
		filename = Replace(filename,"\","")
		url = request.querystring("url")
		Call DownloadFile(filename)
		If request("copypic") <> "1" Then
				'Call DelFile(filename)
		End If
End Sub

sub productlist
	dim postrannum
	randomize
	postrannum = int(900*rnd)+1000
	session("uploadcode") = cstr(postrannum)
	LB_Head()
	LB_Menu()
	%>
	<div class="tabmenu mainwidth">
		  <ul>
			<li <%If datatype = 1 Then Response.Write("class=""current""") End If%>><a href="?datatype=1"><span><%=Lang_Product(156)%></span></a></li>
			<li <%If datatype = 2 Then Response.Write("class=""current""") End If%>><a href="?datatype=2"><span><%=Lang_Product(157)%></span></a></li>
		  </ul>
	</div>
	<%
	Response.Write("<div class=""tab-mainbody"">")
	Response.Write("<div class=""tab-mainbody2"">")
	file = request("file")
	If file <> "" Then 
			Response.write("<iframe src=""?action=down&filename="& file &""" width=""0"" height=""0""></iframe>")
	End If 
%>
<style>
#divposting {
	Z-INDEX: 100; BORDER-BOTTOM: #aaa 0px solid; POSITION: fixed; FILTER: alpha(opacity=60); BORDER-LEFT: #aaa 0px solid; MARGIN: 0px auto; WIDTH: 100%; DISPLAY: none; HEIGHT: 100%; BORDER-TOP: #aaa 0px solid; TOP: 0px; BORDER-RIGHT: #aaa 0px solid; LEFT: 0px; -moz-opacity: 0.60; opacity: 0.60
}
#divposting .loadmes{float:left; POSITION: absolute; left: 50%; top: 50%; width:200px; height:32px; background:url(images/load.gif) no-repeat; padding-left:40px; line-height:32px}
*HTML #divposting {
	POSITION: absolute; HEIGHT: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px')
}
</style>
<script language="javascript" type="text/javascript">
function GetProductNum(e)
{
	xmlHttp.open("GET", "Ajax_Data.asp?action=ProductNum&sort_id="+ e.value +"&t="+Math.random(), true);
	xmlHttp.onreadystatechange = UpGetProductNum;
	xmlHttp.send(null);
}
function UpGetProductNum()
{
  if (xmlHttp.readyState < 4) {
  }
  if (xmlHttp.readyState == 4) {
	var response = xmlHttp.responseText.split("|");
	document.getElementById('startid').value=response[0];
	document.getElementById('endid').value=response[1];
  }
}
</script>
<%If datatype = "1" Then%>
<script language="javascript" type="text/javascript">
function checkform(theform)
{
	if (!isEmpty(theform.categoryid,'<%=Lang_Product(151)%>')) return false;
	if (!isDigit(theform.startid,'<%=Lang_Product(152)%>')) return false;
	if (!isDigit(theform.endid,'<%=Lang_Product(153)%>')) return false;
	if (!isEmpty(theform.filename,'<%=Lang_Product(154)%>')) return false;
	$("#divposting").show();
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="form" class="classtable">
<form action="?action=lead" method="post" name="form" onsubmit="return checkform(this);">
<tr>
  <td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle" title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="datatype" value="1"></td>
  <td align="right" class="classhead">
  <%=QuickMenu("Admin_product_list.asp|"& Lang_Menu(53) &"","admin_product_unite.asp|"& Lang_Menu(70) &"")%>
  </td>
 </tr>
<tr>
   <td class="classtop" height="30" colspan="2"><%=Lang_Product(156)%></td>
</tr>
  <tr class="classrow">
    <td width="15%" class="classrow" valign="top" style="padding-top:6px;">
       <%=Lang_Product(158)%>
    </td>
    <td class="classrow">
       <select name="categoryid" size="8" id="categoryid" onChange="GetProductNum(this)" style="width:230px;">
	   <option value="0"><%=Lang_Product(92)%></option>
        <% check_sort (0),ii,",0," %>
       </select>
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow" valign="top" style="padding-top:6px;">
       <%=Lang_Product(159)%>
    </td>
    <td class="classrow">
       <%=Lang_Product(160)%><input type="text" id="startid" name="startid" size="5" class="form">
	   <%=Lang_Product(161)%><input type="text" id="endid" name="endid" size="5" class="form">
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
		<%=Lang_Product(162)%>
    </td>
    <td class="classrow">
			<input type="text" name="filename" size="33" class="form">
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
       <%=Lang_Product(163)%>
    </td>
    <td class="classrow">
	<%For LangT = 1 To TotalLang%>
	<input type="radio" name="LangTxt" value="<%= LanguageTxt(LangT) %>"<%=judge(LanguageTxt(1),LanguageTxt(LangT))%>><%= LanguageName(LangT) %></option>
	<%Next%>
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
       <%=Lang_Product(164)%>
    </td>
    <td class="classrow">
	   <table cellspacing="0" cellpadding="0">
	   <tr>
		   <td width="100"><input type="radio" name="filetype" value="1" checked><%=Lang_Product(181)%> <img src="images/help.gif" align="absmiddle" onmouseover="showhintinfo(this,0,0,'','<%=Lang_Product(182)%>','50','up');" onmouseout="hidehintinfo();" /></td>
		   <td width="100"><input type="radio" name="filetype" value="2"><%=Lang_Product(183)%> <img src="images/help.gif" align="absmiddle" onmouseover="showhintinfo(this,0,0,'','<%=Lang_Product(182)%>','50','up');" onmouseout="hidehintinfo();" /></td>
		   <td width="100"><input type="radio" name="filetype" value="3"><%=Lang_Product(184)%> <img src="images/help.gif" align="absmiddle" onmouseover="showhintinfo(this,0,0,'','<%=Lang_Product(182)%>','50','up');" onmouseout="hidehintinfo();" /></td>
		   <!--<input type="radio" name="filetype" value="3"><%=Lang_Product(187)%>(待开发)-->
		   <td width="100"><input type="radio" name="filetype" value="4"><%=Lang_Product(185)%> <img src="images/help.gif" align="absmiddle" onmouseover="showhintinfo(this,0,0,'','<%=Lang_Product(186)%>','50','up');" onmouseout="hidehintinfo();" /></td>
		   <td width="100"><input type="radio" name="filetype" value="5"><%=Lang_Product(188)%> <img src="images/help.gif" align="absmiddle" onmouseover="showhintinfo(this,0,0,'','<%=Lang_Product(189)%>','50','up');" onmouseout="hidehintinfo();" /></td>
	   </tr>
	   </table>
    </td>
</tr>
<tr>
<td colspan="2" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
  <%=Lang_Product(222)%>
  </div>
</td>
</tr>
<tr>
   <td class="classtop" height="30" colspan="2"><%=Lang_Product(165)%></td>
</tr>
	  <tr class="classrow">
		<td height="30" class="classrow">
		   <%=Lang_Product(166)%>
		</td>
		<td class="classrow">
		   <input type="text" name="item1" size="33" class="form">
		</td>
	</tr>
	  <tr class="classrow">
		<td height="30" class="classrow">
		   <%=Lang_Product(167)%>
		</td>
		<td class="classrow">
		   <input type="text" name="item2" size="33" class="form">
		</td>
	</tr>
	  <tr class="classrow">
		<td height="30" class="classrow">
		   <%=Lang_Product(168)%>
		</td>
		<td class="classrow">
		   <input type="text" name="item3" size="33" value="1" class="form">
		</td>
	</tr>
	  <tr class="classrow">
		<td height="30" class="classrow">
		   <%=Lang_Product(169)%>
		</td>
		<td class="classrow">
		   <input type="text" name="item4" size="33" value="5" class="form">
		</td>
	</tr>
	  <tr class="classrow">
		<td height="30" class="classrow">
		   <%=Lang_Product(170)%>
		</td>
		<td class="classrow">
		   <input type="text" name="item5" size="33" value="20" class="form">
		</td>
	</tr>
	  <tr class="classrow">
		<td height="30" class="classrow">
		   <%=Lang_Product(171)%>
		</td>
		<td class="classrow">
		   <input type="text" name="item6" size="33" value="10" class="form">
		</td>
	</tr>
<tr>
  <td colspan="2" height="30" align="left" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle" title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
 </tr>
</form>
</table>
<%
End If%>
<%If datatype = "2" Then%>
<script language="javascript" type="text/javascript">
function checkform(theform)
{
	if (!isEmpty(theform.uploadfile,'<%=Lang_Product(155)%>')) return false;
	$("#divposting").show();
}
function changesavecode(num)
{
	if (num == 0)
	{
			document.getElementById("savecode2").disabled = 'true';
			document.getElementById("savetype2").disabled = 'true';
	}else{
			document.getElementById("savecode2").removeAttribute('disabled');
			document.getElementById("savetype2").removeAttribute('disabled');
	}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="form" class="classtable">
<form action="?action=ducting" method="post" name="form2" onsubmit="return checkform(this);" enctype="multipart/form-data">
<tr>
  <td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle" title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
  <td align="right" class="classhead">
  <%=QuickMenu("admin_product_list_simple.asp|"& Lang_Menu(68) &"","admin_product_unite.asp|"& Lang_Menu(70) &"")%>
  </td>
 </tr>
<tr>
   <td class="classtop" height="30" colspan="2"><%=Lang_Product(157)%></td>
</tr>
  <tr class="classrow">
    <td width="15%" class="classrow" valign="top" style="padding-top:6px;">
       <%=Lang_Product(158)%>
    </td>
    <td class="classrow">
       <select name="categoryid" size="8" multiple="multiple" id="categoryid" style="width:200px;">
        <% check_sort (0),ii,",0," %>
       </select>
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
		<%=Lang_Product(172)%>
    </td>
    <td class="classrow">
			<input type="file" name="uploadfile" id="uploadfile" size="15" class="form">
			<input type="hidden" name="uploadcode" value="<%=postrannum%>">
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
       <%=Lang_Product(173)%>
    </td>
    <td class="classrow">
	<input type="radio" name="LangT" value="999" checked><%=Lang_Product(174)%></option>
	<%For LangT = 1 To TotalLang%>
	<input type="radio" name="LangT" value="<%= LangT %>"><%= LanguageName(LangT) %></option>
	<%Next%>
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
       <%=Lang_Product(164)%>
    </td>
    <td class="classrow">
	   <input type="radio" name="filetype" value="1" checked Onclick="changesavecode(0)"><%=Lang_Product(181)%>
	   <input type="radio" name="filetype" value="2" Onclick="changesavecode(1)"><%=Lang_Product(183)%>
	   <input type="radio" name="filetype" value="3" Onclick="changesavecode(1)"><%=Lang_Product(184)%>
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
       <%=Lang_Product(230)%>
    </td>
    <td class="classrow">
	   <input type="radio" name="savecode" id="savecode" value="2" checked><%=Lang_Product(234)%>
	   <input type="radio" name="savecode" id="savecode" value="0"><%=Lang_Product(231)%>
	   <input type="radio" name="savecode" id="savecode2" value="1" disabled><%=Lang_Product(232)%>
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
       <%=Lang_Product(228)%>
    </td>
    <td class="classrow">
	   <input type="radio" name="uptype" value="1" checked><%=Lang_Product(101)%>
	   <input type="radio" name="uptype" value="2"><%=Lang_Product(102)%>
	   <input type="radio" name="uptype" value="3"><%=Lang_Product(229)%>
    </td>
</tr>
  <tr class="classrow">
    <td height="30" class="classrow">
       <%=Lang_Product(175)%>
    </td>
    <td class="classrow">
	   <input type="radio" name="savetype" id="savetype" value="2" checked><%=Lang_Product(176)%> <img src="images/help.gif" align="absmiddle"  onmouseover="showhintinfo(this,0,0,'','<%=Lang_Product(178)%><%=picpath%>/csv','50','up');" onmouseout="hidehintinfo();" />
	   <input type="radio" name="savetype" id="savetype2" value="1" disabled><%=Lang_Product(177)%>
    </td>
</tr>
<tr>
  <td colspan="2" height="30" align="left" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle" title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
 </tr>
</form>
<tr>
<td colspan="2" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
   <%=Lang_Product(179)%>
   <br /><a href="?action=lead&leadtemplate=1&filetype=1&LangTxt=&filename=56770EShop" target="_blank"><u><%=Lang_Product(180)%></u></a>
  </div>
</td>
</tr>
</table>
<%End If%>
<DIV id="divposting"><span class="loadmes"><%=Lang_sys(103)%></span></DIV>
<script>tdshow("form");</script>
<%
	Response.Write("</div>")
	Response.Write("</div>")
	LB_Footer()
end Sub

Function ToCsv(Str)
		ToCsv=Str
		if ToCsv<>"" Then
				If InStr(ToCsv,",")>0 or InStr(ToCsv,vbcrlf)>0 or Mid(ToCsv,1,1)=" " or Mid(ToCsv,Len(ToCsv),1)=" " or InStr(ToCsv,"""")>0 Then
						ToCsv=replace(ToCsv,"""","""""")
						ToCsv=""""&ToCsv&""""
				End If
		End If
End Function

function createpath(pathvalue)
		on error resume next
		set objfso = server.createobject("scripting.filesystemobject")
		if objfso.folderexists(server.mappath(pathvalue))=false then
				objfso.createfolder server.mappath(pathvalue)
		end if
		if err.number = 0 then
				createpath = pathvalue
		end if
		set objfso = nothing
end function

Function ReplaceRemoteUrl(sHTML)
		Dim s_Content
		s_Content = sHTML
		If IsNull(s_Content) Then Exit Function
		Dim re, RemoteFile, RemoteFileurl
		Set re = new RegExp
		re.IgnoreCase  = True
		re.Global = True
		re.Pattern="<img.*?>"
		Set RemoteFile = re.Execute(s_Content)
		Dim a_RemoteUrl(), n, i, bRepeat
		n = 0
		' 转入无重复数据
		For Each RemoteFileurl in RemoteFile
				If n = 0 Then
						n = n + 1
						Redim a_RemoteUrl(n)
						a_RemoteUrl(n) = RemoteFileurl
				Else
						bRepeat = False
						For i = 1 To UBound(a_RemoteUrl)
								If UCase(RemoteFileurl) = UCase(a_RemoteUrl(i)) Then
									bRepeat = True
									Exit For
								End If
						Next
						If bRepeat = False Then
								n = n + 1
								Redim Preserve a_RemoteUrl(n)
								a_RemoteUrl(n) = RemoteFileurl
						End If
				End If
		Next
		for i=1 to n
				re.Pattern="src\=.+?\.(gif|jpg)([\""\' ]+?)"
				Set TempRemoteFile=re.Execute(a_RemoteUrl(i))
				For Each RemoteFileurl in TempRemoteFile
						RStr=Mid(replace(replace(RemoteFileurl,"""",""),"'",""),5)
						if instr(lcase(Mid(RStr,1,7)),"http://")<=0 then
								TRsStr=GetPicHttp(RStr)
								s_Content=replace(s_Content,RStr,TRsStr)
						end if
				Next
		next
		ReplaceRemoteUrl = s_Content
End Function

Function GetPicHttp(PicAddr)
		Dim TempUrlStr
		TempUrlStr="http://"&Request.ServerVariables("SERVER_NAME")
		if Request.ServerVariables("SERVER_PORT")<>80 then TempUrlStr=TempUrlStr&":"&Request.ServerVariables("SERVER_PORT")
		TempUrlStr=TempUrlStr&Eshop_url
		If InStr(PicAddr,"/"& LCase(PicPath) &"/")=0 Then
				TempUrlStr=TempUrlStr&PicPath&"/"
		Else
				PicAddr = Replace(PicAddr,"/"& LCase(PicPath) &"/",LCase(PicPath) &"/")
		End If
		TempUrlStr=TempUrlStr&PicAddr
		GetPicHttp=TempUrlStr
End Function

Function GetOnePic(str)
		If InStr(str,"@@")>0 Then
				GetOnePic = Split(str,"@@")(0)
				If Left(str,2) = "@@" Then GetOnePic = Split(str,"@@")(1)
		Else
				GetOnePic = str
		End If
End Function

Function DownloadFile(strFile)
		Const ForReading = 1
		Const TristateTrue = -1
		Const FILE_TRANSFER_SIZE = 16384
		Dim objFileSystem,objFile,objStream,char,sent,path,FileName,send,s_DownFilePath,s_FileExt,TransferFile
		send = 0
		path = Server.MapPath(strFile)
		Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
		If Not objFileSystem.fileexists(path) Then
				downloadFile = strFile & "文件不存在！"
				Exit Function
		End If
		Set objFile = objFileSystem.GetFile(path)
		s_DownFilePath = objFile.Name
		s_FileExt = Mid(s_DownFilePath, InStrRev(s_DownFilePath, ".") + 1)
		If UCase(s_FileExt) <> "TXT" And UCase(s_FileExt)<>"CSV" And UCase(s_FileExt)<>"XLS" And UCase(s_FileExt) <> "RAR" Then
				downloadFile = "只能下载扩展名为txt或CSV或xls或rar的文件！"
				Exit Function
		End If
		Set objStream = objFile.OpenAsTextStream(ForReading, TristateTrue)
		Response.AddHeader "content-type", "application/server"
		Response.AddHeader "Content-Disposition", "attachment;filename=" & s_DownFilePath
		Response.AddHeader "content-length", objFile.Size
		Do While Not objStream.AtEndOfStream
				char = objStream.Read(1)
				Response.BinaryWrite (char)
				sent = sent + 1
				If (sent Mod FILE_TRANSFER_SIZE) = 0 Then
						Response.Flush
						If Not Response.IsClientConnected Then Exit Do
				End If
		Loop
		Response.Flush
		If Not Response.IsClientConnected Then TransferFile = False
		objStream.Close
		Set objStream = Nothing
		Set objFileSystem = Nothing
End Function

Sub DelFile(FileName)
'		Dim fso,path
'		Set fso = Server.CreateObject("scripting.filesystemobject")
'		If InStr(FileName, ":") <> 0 Then path = FileName Else path = Server.MapPath(FileName)
'		if fso.fileexists(path) then fso.DeleteFile (path)
'		Set fso = Nothing
End Sub

Function GetPriceArr(id)
		Set rs = conn.execute("Select price from [Lebi_Product_price] where product_id = "& id &" order by grade_id asc")
		If rs.eof Then
				GetPriceArr = 0
				Exit Function
		End If
		Do While Not rs.eof
				GetPriceArr = GetPriceArr & rs(0) &"|"
		rs.movenext
		Loop
		rs.close
		GetPriceArr = Left(GetPriceArr,Len(GetPriceArr)-1)
End Function
Function GetCsvPic2(spic,stype,smode)
		If InStr(spic,";") > 0 Then
				If smode = 0 Then 
						GetCsvPic = "csv/"& Split(Split(spic,";")(0),":")(0) &".jpg"
				Else
						GetCsvPic = ""
						For i = 0 To UBound(Split(spic,";"))
								If InStr(Split(spic,";")(i),":") > 0 Then 
										GetCsvPic = GetCsvPic & "@@csv/"& Split(Split(spic,";")(i),":")(0) &".jpg"
								End If 
						Next 
				End If 
		Else
				If smode = 0 Then 
						GetCsvPic = spic
				Else
						GetCsvPic = "@@"& spic
				End If 
		End If
End Function

Function ChangeToTbi(pic)
		If pic = "" Then
				Exit Function
		End If
		apic = Split(pic,".")
		ChangeToTbi = apic(0)
		If InStr(ChangeToTbi,"/") > 0 Then ChangeToTbi = Split(ChangeToTbi,"/")(1)
End Function

Function ChangeToPP(pic)
		If pic = "" Then
				Exit Function
		End If
		ChangeToPP = pic
		If InStr(ChangeToPP,"/") > 0 Then ChangeToPP = Split(ChangeToPP,"/")(1)
End Function

Function CopyFiles(TempSource,TempEnd)
		On Error Resume Next
		Dim FSOCopyFiles
		Set FSOCopyFiles = Server.CreateObject("Scripting.FileSystemObject")
		IF FSOCopyFiles.FileExists(TempEnd) then '目标备份文件已存在
			   Set FSOCopyFiles=Nothing
			   Exit Function
		End IF
		IF FSOCopyFiles.FileExists(TempSource) Then
		Else '要复制的源数据库文件不存在
			   Set FSOCopyFiles=Nothing
			   Exit Function
		End If
		FSOCopyFiles.CopyFile TempSource,TempEnd
		Set FSOCopyFiles = Nothing
End Function

Function GetCsvValue(str)
		If str = "" Or Left(str,1) <> """" Then
				GetCsvValue = str
				Exit Function
		End If
		GetCsvValue = CutText(CutText(str,0,1),1,1)
End Function

Function LoadFileGb2312(strFile)
		On Error Resume Next
		Dim strTempPath,objFSO,objStm
		strTempPath = Server.MapPath(strFile)
		Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		Set objStm = Server.CreateObject("ADODB.Stream")
			If objFso.FileExists(strTempPath) Then
				objStm.charset = "Gb2312"
				objStm.open
				objStm.LoadFromFile strTempPath
				LoadFileGb2312 = objStm.ReadText
			End If
		Set objStm = Nothing
		Set objFSO = Nothing
		If Err Then
			    Err.Clear
		End If
End Function

Function CheckCode(path)
		path = Server.MapPath(path)
		set objstream=server.createobject("adodb.stream")
		objstream.Type=1
		objstream.mode=3
		objstream.open
		objstream.Position=0
		objstream.loadfromfile path
		bintou=objstream.read(2)
		If AscB(MidB(bintou,1,1))=&HEF And AscB(MidB(bintou,2,1))=&HBB Then
				CheckCode="utf-8"
		ElseIf AscB(MidB(bintou,1,1))=&HFF And AscB(MidB(bintou,2,1))=&HFE Then
				CheckCode="unicode"
		Else
				CheckCode="gb2312"
		End If
		objstream.close
		set objstream=nothing
End Function
%>