<%
'**************************************
'* 最后更新 2014-01-02 by 56770.Kingdge
'* Copyright www.56770.com
'**************************************
Dim s_m(1)
s_m(0) = "官方网站|http://www.56770.com/,客服中心|http://www.56770.com/support/,交流论坛|http://www.56770.com/bbs/,购买正版|http://www.56770.com/service/,使用帮助|http://www.56770.com/faq/,功能定制|http://www.56770.com/custom/,运营推广|http://www.56770.com/operation/,BUG 反馈|http://www.56770.com/book/?action=add&t=1"
s_m(1) = "域名注册|http://72e.56770.com/domain/index.aspx,虚拟主机|http://www.56770.com/value-add/host.html,海外主机|http://www.56770.com/value-add/overseas_host.html,企业邮局|http://72e.56770.com/email/index.aspx,400电话|http://72e.56770.com/400/index.aspx"
Sub CheckOutSubmit()
		OutSubmit = "0"
		If OutSubmit = "1" Then
        server_v1 = Cstr(Request.ServerVariables("HTTP_REFERER"))
        server_v2 = Cstr(Request.ServerVariables("SERVER_NAME"))
        if mid(server_v1,8,len(server_v2)) <> server_v2  Then
				Close_mes Lang_sys(46),Lang_sys(94),3
        end If
        End If
End Sub
sub adminflag()
       if Eshop_Lebi_name<>"" then
               Call Up_mes(Lang_sys(46),"·"& Lang_sys(85),0,"javascript:history.back()",0,0,5,0)
       Else
               Call Up_mes(Lang_sys(46),"·"& Lang_sys(78),0,Eshop_url & AdminPath &"/admin_login.asp",0,0,3,0)
       end if
       response.write"<script>tdshow('noflag');</script>"
       response.write"</div>"
       response.write"</div>"
	   LB_Footer()
	   response.End
end sub
Sub LB_Head()
		Temp = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"" ""http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"">"&_
				    "<HTML xmlns=""http://www.w3.org/1999/xhtml"">"&_
				    "<HEAD>"&_
				    "<TITLE>"& ArrData(2) &" 后台管理</TITLE>"&_
				    "<META content=""IE=EmulateIE7"" http-equiv=""X-UA-Compatible"">"&_
				    "<META content=""text/html; charset=UTF-8"" http-equiv=""content-type"">"&_
				    "<LINK rel=icon type=""image/x-icon"" href=""http://www.56770.com/favicon.ico"" media=""screen"">"&_
				    "<LINK rel=""shortcut icon"" type=""image/x-icon"" href=""http://www.56770.com/favicon.ico"" media=""screen"">"&_
				    "<META name=""author"" content=""56770 Eshop"">"&_
				    "<LINK rel=""stylesheet"" type=""text/css"" href="""& Eshop_url & AdminPath &"/images/css.css"" media=""screen"">"&_
				    "<script language=""javascript"" type=""text/javascript"" src="""& Eshop_url & AdminPath &"/inc/js/jquery-1.4.4.min.js""></script>"&_
				    "<script language=""javascript"" type=""text/javascript"" src="""& Eshop_url & AdminPath &"/inc/js/admin.js""></script>"&_
				    "<script language=""javascript"" type=""text/javascript"" src="""& Eshop_url & AdminPath &"/inc/js/tab.js""></script>"&_
				    "<script language=""javascript"" type=""text/javascript"" src="""& Eshop_url & AdminPath &"/inc/js/common.js""></script>"&_
				    "<script>var AdminPath = """& Eshop_url & AdminPath &"/""; function quit(){if(confirm("""& Lang_Menu(30) &"""))return true;else return false;}</script>"&_
					"</HEAD>"&_
				    "<BODY>"&_
				    "<div id=""dhtmltooltip""><img src="""& Eshop_url & AdminPath &"/images/img.gif"" /></div>"
		Response.Write(Temp)
End Sub
Sub LB_Head_Vertical()
		Temp = "<DIV class=""logo"">"
		If Trim(ArrData(3)) <> "" Then
				  Temp = Temp &"<IMG style=""BORDER-RIGHT-WIDTH: 0px; WIDTH: 227px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 53px; BORDER-LEFT-WIDTH: 0px"" src="""& Eshop_url & ArrData(3) &""">"
		End If
		Temp = Temp &"<SPAN></SPAN>"&_
				  "</DIV>"&_
				  "<DIV class=""service"">"&_
				  "<DIV class=""software""><img src="""& Eshop_url & AdminPath &"/images/icon/11.gif"" align=""absmiddle"">"
		Temp = Temp &"<a href=""../TaobaoSYN/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(200) &"</STRONG></a>"
		Temp = Temp &"<a href=""../ExpressPrint/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(199) &"</STRONG></a>"
		If InStr(ArrData(4),1) > 0 Then
				Temp = Temp &"<a href=""../jxc/Admin_index.asp"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(2) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),2) > 0 Then
				Temp = Temp &"<a href=""../WebService/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(3) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),3) > 0 Then
				Temp = Temp &"<a href=""../QS/QS_Admin_default.asp"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(186) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),4) > 0 Then
				Temp = Temp &"<a href=""../Union/admin_manage.asp"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(189) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),5) > 0 Then
				Temp = Temp &"<a href="""& Eshop_url &"groupon/admin/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(198) &"</STRONG></a>"
		End If
		Temp = Temp &"<a href=""mailto:support@56770.com?subject="& server.urlencode("BUG反馈") &"&body="& Backurl()&""" target=""_blank""><img title=""BUG反馈"" src="""& Eshop_url & AdminPath &"/images/bug.png"" align=""absmiddle"" /></a></DIV>"&_
				  "<DIV class=""layout"">"& Lang_sys(100) &"<a href="""& Eshop_url & AdminPath &"/admin_pass.asp?action=layout&type=0"">"& Lang_sys(101) &"</a></DIV>"&_
				  "</DIV>"&_
		          "<DIV class=""clearfix""></DIV>"
		Response.Write(Temp)
End Sub
Sub LB_Menu()
		If MenuType = 0 Then 
		Dim l_m(10)
		l_m(0) = Lang_Menu(8) &"|manage.asp|2.gif|0,"& Lang_Menu(10) &"|admin_product_list.asp|3.gif|1,"& Lang_Menu(12) &"|Admin_orders.asp|4.gif|2,"& Lang_Menu(14) &"|Admin_user.asp|5.gif|3,"& Lang_Menu(16) &"|Home_Mes.asp|6.gif|4,"& Lang_Menu(18) &"|admin_system.asp|7.gif|5,"& Lang_Menu(20) &"|admin_skin.asp|8.gif|6,"& Lang_Menu(23) &"|admin_html.asp|9.gif|7,"& Lang_Menu(25) &"|Admin_plugin.asp|10.gif|8"
		CurrentId = checknum(CurrentId,0)
		Temp = "<DIV class=""head"">"&_
				  "<DIV class=""logo"">"
		If Trim(ArrData(3)) <> "" Then
				  Temp = Temp &"<IMG style=""BORDER-RIGHT-WIDTH: 0px; WIDTH: 227px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; HEIGHT: 53px; BORDER-LEFT-WIDTH: 0px"" src="""& Eshop_url & ArrData(3) &""">"
		End If
		Temp = Temp &"<SPAN></SPAN>"&_
				  "</DIV>"&_
				  "<DIV class=""service"">"&_
				  "<DIV class=""software""><img src="""& Eshop_url & AdminPath &"/images/icon/11.gif"" align=""absmiddle"">"
		Temp = Temp &"<a href=""../TaobaoSYN/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(200) &"</STRONG></a>"
		Temp = Temp &"<a href=""../ExpressPrint/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(199) &"</STRONG></a>"
		If InStr(ArrData(4),1) > 0 Then
				Temp = Temp &"<a href="""& Eshop_url &"jxc/Admin_index.asp"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(2) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),2) > 0 Then
				Temp = Temp &"<a href="""& Eshop_url &"WebService/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(3) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),3) > 0 Then
				Temp = Temp &"<a href="""& Eshop_url &"QS/QS_Admin_default.asp"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(186) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),4) > 0 Then
				Temp = Temp &"<a href="""& Eshop_url &"Union/admin_manage.asp"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(189) &"</STRONG></a>"
		End If
		If InStr(ArrData(4),5) > 0 Then
				Temp = Temp &"<a href="""& Eshop_url &"groupon/admin/"" class=""head1"" target=""_blank""><STRONG>"& Lang_Menu(198) &"</STRONG></a>"
		End If
		Temp = Temp &"<a href=""mailto:support@56770.com?subject="& server.urlencode("BUG反馈") &"&body="& Backurl()&""" target=""_blank""><img title=""BUG反馈"" src="""& Eshop_url & AdminPath &"/images/bug.png"" align=""absmiddle"" /></a></DIV>"&_
				  "<DIV class=""helpmenu""><div class=""hello"">Hi! <SPAN>"& Eshop_Lebi_name &"</SPAN> [<A href=""admin_pass.asp""><STRONG STYLE=""COLOR: #0000FF"">"& Lang_Menu(192) &"</STRONG></A><A href=""quit.asp"" onclick=""return quit()""><STRONG STYLE=""COLOR: #FF0000"">"& Lang_Menu(1) &"</STRONG></A>] <A href="""& Eshop_url &""" target=""_blank"">"& Lang_Menu(4) &"</A></div>"
		Temp = Temp &"<DIV class=""layout"">"& Lang_sys(100) &"<a href="""& Eshop_url & AdminPath &"/admin_pass.asp?action=layout&type=1"">"& Lang_sys(102) &"</a></div>"
		If ArrData(7) = 1 Then
				Temp = Temp &"<div id=""m1"" class=""quickservice""><ul class=""m_ul""><li class=""m_li"" onmouseover=""showmenu(this,0);""><a href=""#"">商业版本</a><div class=""l_m"" onmouseout=""hidemenu(1);hidemenu(0)"">"
				smenu = Split(s_m(0),",")
				For p = 0 To UBound(smenu)
						Temp = Temp &"<A href="""& split(smenu(p),"|")(1) &""" target=""_blank"" onmouseover=""showmenu(this,1)"">"& split(smenu(p),"|")(0) &"</A>"
				Next
				Temp = Temp &"</div></li></ul>"
'		End If
'		If InStr(ArrData(5),2) > 0 Then
				Temp = Temp &"<ul class=""m_ul""><li class=""m_li"" onmouseover=""showmenu(this,0);""><a href=""#"">建站服务</a><div class=""l_m"" onmouseout=""hidemenu(1);hidemenu(0)"">"
				smenu = Split(s_m(1),",")
				For p = 0 To UBound(smenu)
						Temp = Temp &"<A href="""& split(smenu(p),"|")(1) &""" target=""_blank"" onmouseover=""showmenu(this,1)"">"& split(smenu(p),"|")(0) &"</A>"
				Next
				Temp = Temp &"</div></li></ul></div>"
		End If
		Temp = Temp &"</P>"&_
				  "</DIV>"&_
				  "</DIV>"&_
				  "<DIV id=""NewEvent""></DIV>"&_
				  "<DIV class=""fathermenu clearfix"">"&_
				  "<DIV class=""menus"">"&_
				  "<DIV class=""menutab"">"&_
				  "<UL class=""clearfix"">"
		fathermenu = Split(l_m(0),",")
		For s = 0 To UBound(fathermenu)
				If CLng(CurrentId) = CLng(s) Then
						current = "class=current"
				Else
						current = ""
				End If
				Temp = Temp &"<LI "& current &"><A onmouseover=""ShowMenu("& s &",'"& split(fathermenu(s),"|")(1) &"','');"" href="""& Eshop_url & AdminPath &"/"& split(fathermenu(s),"|")(1) &"""><SPAN><IMG src="""& Eshop_url & AdminPath &"/images/icon/"& split(fathermenu(s),"|")(2) &""" width=""16"" height=""16"" />"& split(fathermenu(s),"|")(0) &"</SPAN></A> </LI>"
		Next
		Temp = Temp &"</UL></DIV></DIV></DIV>"&_
		          "<DIV class=""parentmenu clearfix""><DIV class=""menus""><DIV class=""menutab""><UL class=""clearfix"" id=""parentmenu""><script language=""javascript"" type=""text/javascript"">ShowMenu("& CurrentId &",'"& CurrentUrl &"','"& PluginId &"','');</script></UL></DIV></DIV></DIV>"&_
		          "<DIV class=""blank clearfix""></DIV>"
		Else
				Temp = Temp &"<LINK rel=""stylesheet"" type=""text/css"" href="""& Eshop_url & AdminPath &"/images/vertical/pannel.css"" media=""screen""><script language=""javascript"" type=""text/javascript"" src="""& Eshop_url & AdminPath &"/images/vertical/admin.js""></script><DIV class=""head"">"
		End If 
		Response.Write(Temp)
End Sub
Sub LB_Footer()
		If MenuType = 0 Then 
		Temp = "<div class=""foot""><div class=""copy"">"
		If ArrData(8) = "1" Then
				Temp = Temp &"Copyright &copy; 2003-"&Year(Date())&" <a href=""http://www.56770.com/"" target=""_blank"" class=""footcopy"">56770.COM</a> , All Rights Reserved. <a href=""http://www.56770.com/support/detail/?ref="&server.urlencode(Request.ServerVariables("SERVER_NAME"))&""" target=""_blank"" class=""footcopy"">Powered by 56770 EShop</a>"
		End If
		Temp = Temp &"</div><div class=""lang""><ul class=""m_ul""><li class=""m_li"" onmouseover=""showmenu(this,0);""><a href=""#"">"& Lang_sys(97) &"</a><div class=""l_m"" onmouseout=""hidemenu(1);hidemenu(0)""><a href="""& Eshop_Url & AdminPath &"/cookies.asp?LangFilePath=zh-cn&url="& server.urlencode(backurl()) &""" onmouseover=""showmenu(this,1)"">简体中文</a><a href="""& Eshop_Url & AdminPath &"/cookies.asp?LangFilePath=zh-tw&url="& server.urlencode(backurl()) &""" onmouseover=""showmenu(this,1)"">繁體中文</a><a href="""& Eshop_Url & AdminPath &"/cookies.asp?LangFilePath=en&url="& server.urlencode(backurl()) &""" onmouseover=""showmenu(this,1)"" style=""display:none"">English</a></div></li></ul></div><script type=""text/javascript"">(function() {var $backToTopEle = $('<div class=""backToTop""></div>').appendTo($(""body"")).click(function() {$(""html, body"").animate({ scrollTop: 0 }, 120);}), $backToTopFun = function() {var st = $(document).scrollTop(), winh = $(window).height();(st > 0)? $backToTopEle.show(): $backToTopEle.hide();if (!window.XMLHttpRequest) {$backToTopEle.css(""top"", st + winh - 166);}};$(window).bind(""scroll"", $backToTopFun);$(function() { $backToTopFun(); });})();</script></body></html>"
		Response.Write(Temp)
		End If 
		Conn.close : Set Conn = Nothing
End Sub
Sub LB_Footer_Vertical()
		Temp = "<div class=""foot""><div class=""copy"">"
		If ArrData(8) = "1" Then
				Temp = Temp &"Copyright &copy; 2003-"&Year(Date())&" <a href=""http://www.56770.com/"" target=""_blank"" class=""footcopy"">56770.COM</a> , All Rights Reserved. <a href=""http://www.56770.com/support/detail/?ref="&server.urlencode(Request.ServerVariables("SERVER_NAME"))&""" target=""_blank"" class=""footcopy"">Powered by 56770 EShop</a>"
		End If
		Temp = Temp &"</div><div class=""lang""><ul class=""m_ul""><li class=""m_li"" onmouseover=""showmenu(this,0);""><a href=""#"">"& Lang_sys(97) &"</a><div class=""l_m"" onmouseout=""hidemenu(1);hidemenu(0)""><a href="""& Eshop_Url & AdminPath &"/cookies.asp?LangFilePath=zh-cn&url="& server.urlencode(backurl()) &""" onmouseover=""showmenu(this,1)"">简体中文</a><a href="""& Eshop_Url & AdminPath &"/cookies.asp?LangFilePath=zh-tw&url="& server.urlencode(backurl()) &""" onmouseover=""showmenu(this,1)"">繁體中文</a><a href="""& Eshop_Url & AdminPath &"/cookies.asp?LangFilePath=en&url="& server.urlencode(backurl()) &""" onmouseover=""showmenu(this,1)"" style=""display:none"">English</a></div></li></ul></div><script type=""text/javascript"">(function() {var $backToTopEle = $('<div class=""backToTop""></div>').appendTo($(""body"")).click(function() {$(""html, body"").animate({ scrollTop: 0 }, 120);}), $backToTopFun = function() {var st = $(document).scrollTop(), winh = $(window).height();(st > 0)? $backToTopEle.show(): $backToTopEle.hide();if (!window.XMLHttpRequest) {$backToTopEle.css(""top"", st + winh - 166);}};$(window).bind(""scroll"", $backToTopFun);$(function() { $backToTopFun(); });})();</script></body></html>"
		Response.Write(Temp)
		Conn.close : Set Conn = Nothing
End Sub
Sub FreeUser()
		Call Up_mes(Lang_sys(46),"·很抱歉，当前版本不包含此功能！",0,"javascript:history.back()",0,0,10,0)
End Sub
sub sort(a,b,c)
		sql="select c_id,c_name,c_child from [Lebi_category] where c_parentid = "& a &" order by c_order desc"
		Set Rs1=Conn.Execute(sql)
		If Not Rs1.eof Then
			sortdata = rs1.getrows()
			Issortdata = 1
		End If
		Rs1.close : Set Rs1 = Nothing
		If Issortdata = 1 Then
			For ii = 0 To UBound(sortdata,2)
				If a = 0 Then
						Response.write("<option value='"& clng(sortdata(0,ii)) &"'")
				if clng(sortdata(0,ii)) = clng(c) Then Response.write("Selected")
						Response.write(">+ "& sortdata(1,ii) &"</option>")
				Else
						Response.write("<option value='"& clng(sortdata(0,ii)) &"'")
				If clng(sortdata(0,ii)) = clng(c) Then Response.write("Selected")
						Response.write(">"& tmp(b,"├ ") &" "& sortdata(1,ii) &"</option>")
				End If
				if sortdata(2,ii)>0 Then
					b=b+1
					sort sortdata(0,ii),b,c
					b=b-1
				End If
			Next
		End If
end Sub
sub check_sort(a,b,c)
		sql="select c_id,c_name,c_child from [Lebi_category] where c_parentid = "& a &" order by c_order desc"
		Set Rs1=Conn.Execute(sql)
		If Not Rs1.eof Then
			sortdata = rs1.getrows()
			Issortdata = 1
		End If
		Rs1.close : Set Rs1 = Nothing
		If Issortdata = 1 Then
			For ii = 0 To UBound(sortdata,2)
				If a = 0 Then
						Response.write("<option value='"& clng(sortdata(0,ii)) &"'")
				if instr(c,","& sortdata(0,ii) &",") > 0  Then Response.write("Selected")
						Response.write(">+ "& sortdata(1,ii) &"</option>")
				Else
						Response.write("<option value='"& clng(sortdata(0,ii)) &"'")
				If instr(c,","& sortdata(0,ii) &",") > 0 Then Response.write("Selected")
						Response.write(">"& tmp(b,"├ ") &" "& sortdata(1,ii) &"</option>")
				End If
				if sortdata(2,ii)>0 Then
					b=b+1
					check_sort sortdata(0,ii),b,c
					b=b-1
				End If
			Next
		End If
end Sub
Function tmp(a,b)
        Dim tmp_i
        For tmp_i = 1 To a
            tmp = tmp & "&nbsp;|&nbsp;&nbsp;"
        Next
	tmp = tmp & b
End Function
Function Safereplace(Str)
	    If Isnull(Str) Then
	    	    Safereplace = ""
	    	    Exit Function
	    End If
	    Str = Replace(Trim(Str),"'","&#180;")
	    Str = Replace(Str,"%","")
	    Str = Replace(Str,"""","&#34;")
        Str = Replace(Str,"<","&lt;")
        Str = Replace(Str,">","&gt;")
	    Str = Replace(Str,"$","")
	    Safereplace = Str
End Function
Function NoEnter(Str)
	    If Isnull(Str) Then
	    	    NoEnter = ""
	    	    Exit Function
	    End If
		Str = Replace(Str,Chr(8),"")
		Str = Replace(Str,Chr(9),"")
		Str = Replace(Str,Chr(10),"")
		Str = Replace(Str,Chr(13),"")
	    NoEnter = Str
End Function
Function CheckNum(num,back)
		num = Trim(num)
		If Not IsNumeric(num) Or IsEmpty(num) Then
				CheckNum = CLng(back)
		Else
				CheckNum = num
		End If
End Function
Function StyleSafereplace(Str)
		Dim Hackchar
		Hackchar = "insert,truncate,declare,createtextfile,createdirectory,deletedirectory,deletefolder,opentextfile,filesystemobject,adodb.stream,savehtml,server.,scripting.,shell.application,wscript,xmlhttp,script.encode,javascript.encode"
	    If Isnull(Str) Then
	    	    StyleSafereplace = ""
	    	    Exit Function
	    End If
		str = Replace(str,"'","&#180;")
		If InStr(str,"<%")>0 Or InStr(str,"%\>")>0 Then
		        response.write("<script>alert('"& Lang_sys(87) &"');javascript:history.back()</script>")
				response.End
		End If
		For i = 0 To UBound(Split(Hackchar,","))
				If InStr(LCase(str),Split(Hackchar,",")(i)) > 0 Then
						response.write("<script>alert('"& Lang_sys(87) &"["& Split(Hackchar,",")(i) &"]');javascript:history.back()</script>")
						response.End
				End If
		Next
		If (InStr(LCase(str),"execute(request")>0 or InStr(LCase(str),"execute request")>0) Or (InStr(LCase(str),"eval(request")>0 or InStr(LCase(str),"eval request")>0) Or (InStr(LCase(str),"eval(session")>0 or InStr(LCase(str),"eval session")>0) Then
		        response.write("<script>alert('"& Lang_sys(87) &"[execute]');javascript:history.back()</script>")
				response.End
		End If
'		If Eshop_url <> "/" Then
'				Str = Replace(Str,Eshop_url,"")
'		Else
'				Str = Replace(Str,"""/","""")
'				Str = Replace(Str,"=/","=")
'		End If
	    StyleSafereplace = Str
End Function
Function change(Str)
	    Str = Replace(Str,"{","<%=")
	    Str = Replace(Str,"]","%")
		Str = Replace(Str,"}",">")
	    change = Str
End Function
sub Up_mes(m_t,m_s,m_s_z,m_u,m_u2,m_u3,m_time,m_type)
        Dim picname
        If m_type = 1 Then
		        picname = "ok.gif"
		Else
		        picname = "err.gif"
		End If
        response.write"<table width=100% border=0 align=center cellpadding=0 cellspacing=0 class=classtable>"&_
                      "<tr><td height=30 class=classrow colspan=2>&nbsp;&nbsp;&nbsp;&nbsp;<strong>"& m_t &"</strong></td></tr>"&_
                      "<tr><td class=classrow align=center width='8%' valign='top'><img src='"& Eshop_url & Adminpath &"/images/"& picname &"'></td>"&_
                      "<td class=classrow valign='top'>"&_
					  "<table width=100% border=0 align=center cellpadding=0 cellspacing=0 id=up_mes>"&_
					  "<tr><td height=30 class=classrow><div style=""height:30px;OVERFLOW: auto;"">"&m_s&"</div></td></tr>"&_
					  "<tr><td class=classrow>"
					  If m_s_z <> "0" Then
					          response.write m_s_z &"<br />"
					  End If
					  If m_time <> "0" Then
					          response.write"·"& replace(Lang_sys(88),"[time]","<font color=red><span id=""backtime"">0</span></font>")&"<a href="& m_u &">"& Lang_sys(89) &"</a><br />"
					  End If
					  If m_u2 <> "0" Then
					          response.write"·"& Lang_sys(90) &"<a href="& m_u2 &">"& m_u2 &"</a><br />"
					  End If
					  If m_u3 <> "0" Then
					          response.write"·"& Lang_sys(90) &"<a href="& m_u3 &">"& m_u3 &"</a><br />"
					  End If
					  response.write"·<a href=javascript:history.go(-1)>"& Lang_sys(91) &"</a></td></tr>"&_
                      "</table>"&_
					  "</td></tr></table>"&_
					  "<script language=""JavaScript"">tdshow('up_mes');"
					  If m_time <> "0" Then
					          response.write"Url="""& m_u &""";if (!Url){Url=document.referrer}function countDown(secs){document.getElementById(""backtime"").innerHTML=secs;if(--secs>0) {setTimeout(""countDown(""+secs+"")"",1000);}else {window.location.href=Url;}}countDown("& m_time &");setTimeout(function(){window.location.href=Url;},"& (m_time +1) * 1000 &");"
					  End If
        response.write"</script>"&_
					  "</div>"&_
					  "</div>"
		LB_Footer()
		response.End
End sub
sub Close_mes(m_t,m_s,m_time)
        response.write"<table width=100% border=0 align=center cellpadding=0 cellspacing=0 id=close_mes class=classtable>"&_
                      "<tr><td height=30 class=classhead><strong>"& m_t &"</strong></td></tr>"&_
                      "<tr><td height=50 class=classrow>"& m_s &"</td></tr>"&_
		              "<tr><td height=30 class=classrow>·"& Replace(Lang_sys(92),"[time]","<font color=red>"& m_time &"</font>") &"</td></tr>"&_
                      "</table>"&_
					  "<script>tdshow('close_mes');setTimeout('window.close();',"& m_time*1000 &");window.opener.location.reload();</script>"
		response.End
End sub
function judge(a,b)
        dim res
        if instr(","& a &",",","& b &",")>0 then
                res ="checked"
        end if
        judge = res
end Function
function judge2(a,b)
        dim res
        if instr(","& a &",",","& b &",")>0 then
               res ="selected"
        end if
        judge2= res
end Function
Function sortdate(str,str1)
       If str="" Then
	        Exit Function
	   End If
	   news_year=year(str)
       news_month=month(str)
       If Len(news_month)=1 Then news_month="0"&news_month
       news_day=day(str)
       If Len(news_day)=1 Then news_day="0"&news_day
	   If str1=0 Then
       sortdate=CLng(news_month&news_day)
	   Else
	   sortdate=CLng(news_year&news_month&news_day)
	   End If
End Function
function formatnumber2(num)
        If IsNull(num) Or Not IsNumeric(num) Then
		        Exit Function
	    End If
	    num = formatnumber(num,2)
	    if num <1 And num > 0 then
	            num= 0&num
	            num = replace(num,"00.","0.")
		ElseIf num = 0 Then
				num= 0&num
	    end if
	    formatnumber2 = Replace(num,",","")
end Function
Function Backurl()
	   Backurl=Request.ServerVariables("URL")
	   If Request.ServerVariables("QUERY_STRING")<>"" Then Backurl=Backurl&"?"& Request.ServerVariables("QUERY_STRING")
End Function
function JoinChar(strUrl)
		if strUrl="" then
				JoinChar=""
				exit function
		end if
		if InStr(strUrl,"?")<len(strUrl) then
				if InStr(strUrl,"?")>1 then
						if InStr(strUrl,"&")<len(strUrl) then
								JoinChar=strUrl & "&"
						else
								JoinChar=strUrl
						end if
				else
						JoinChar=strUrl & "?"
				end if
		else
				JoinChar=strUrl
		end if
end function
Function IsObjInstalled(strClassString)
		On Error Resume Next
		IsObjInstalled = False
		Err = 0
		Dim xTestObj
		Set xTestObj = Server.CreateObject(strClassString)
		If 0 = Err Then IsObjInstalled = True
		Set xTestObj = Nothing
		Err = 0
End Function
Sub Get_Usersurl()
		User_Url= Request.ServerVariables("SERVER_NAME") & Eshop_url
		u = User_Url
		v = copy_soft
		if v<>"" then v = server.urlencode(v)
		If session("IsGet_Usersurl") = "" Then
				response.write("<script src=""http://www.56770.com/post/a2.asp?u="& server.urlencode(u) &"&v="& v &"""></script>")
				session("IsGet_Usersurl") = "1"
		End If
End Sub
Function CutText(str,stralign,cutnum)
		On Error Resume Next 
		If str = "" Or IsNull(str) Then Exit Function
		Select Case stralign
			   Case "0"
					CutText = left(str,Len(str)-cutnum)
			   Case "1"
					CutText = right(str,Len(str)-cutnum)
		End Select
End Function
Function Savehtml(filename,filebody)
		On Error Resume Next
        filename = server.mappath(filename)
		filebody = Replace(filebody,"&lt;","<")
		filebody = Replace(filebody,"&gt;",">")
		filebody = Replace(filebody,"&quot;","""")
		filebody = Replace(filebody,"&amp;","&")
		filebody = Replace(filebody,"&middot;","·")
        adTypeText=2
        adSaveCreateOverWrite=2
        Set objStream = Server.CreateObject("ADODB.Stream")
        With objStream
                .Type = adTypeText
                .Mode = adModeReadWrite
                .Open
                .Charset = "utf-8"
                .Position = objStream.Size
                .WriteText= filebody
                .SaveToFile FileName,adSaveCreateOverWrite
                .Close
        End With
End Function
Function SavehtmlGb2312(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 LoadFile(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 = "UTF-8"
				objStm.open
				objStm.LoadFromFile strTempPath
				LoadFile = objStm.ReadText
			End If
		Set objStm = Nothing
		Set objFSO = Nothing
		If Err Then
			    Err.Clear
		End If
End Function
Function AdminLoadStyle(strFile)
		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 = "UTF-8"
				objStm.open
				objStm.LoadFromFile strTempPath
				AdminLoadStyle = objStm.ReadText
			End If
		Set objStm = Nothing
		Set objFSO = Nothing
End Function
Sub Write_56770_Eshop(value)
		Response.Write(value)
End Sub
Function CreateConfig()
		For LangT = 1 To TotalLang
				set Rs = conn.execute("select name"& LanguageTxt(LangT) &",mail"& LanguageTxt(LangT) &",web"& LanguageTxt(LangT) &",sitename"& LanguageTxt(LangT) &",fax"& LanguageTxt(LangT) &",code,info,sys_tel"& LanguageTxt(LangT) &",sys_oicq,lockip,sys_setup,sys_description"& LanguageTxt(LangT) &",sys_keywords"& LanguageTxt(LangT) &",sys_upload,sys_logo"& LanguageTxt(LangT) &",sys_skip_window,sys_ext,sys_qq"& LanguageTxt(LangT) &",sys_kuaidi100,id from [Lebi_system]")
				Dim sys_temp
				sys_temp = rs.getstring(,1,"<><>","","")
				rs.close : Set rs=Nothing
				www56770com_sys_56770system = Split(sys_temp,"<><>")
				str_tmp = "<%"&vbcrlf
				str_tmp = str_tmp &"rem 以下变量由56770 Eshop网上开店系统（www.56770.com）自动生成"&vbcrlf
				str_tmp = str_tmp &"response.charset = ""UTF-8"""&vbcrlf
				str_tmp = str_tmp &"session.codepage = ""65001"""&vbcrlf
				str_tmp = str_tmp &"Const sys_name = """& www56770com_sys_56770system(0) &""""&vbcrlf
				str_tmp = str_tmp &"Const sys_mail = """& www56770com_sys_56770system(1) &""""&vbcrlf
				str_tmp = str_tmp &"Const site_url = """& www56770com_sys_56770system(2) &""""&vbcrlf
				str_tmp = str_tmp &"Const site_name = """& www56770com_sys_56770system(3) &""""&vbcrlf
				str_tmp = str_tmp &"Const sys_fax = """& www56770com_sys_56770system(4) &""""&vbcrlf
				str_tmp = str_tmp &"Const code = """& www56770com_sys_56770system(5) &""""&vbcrlf
				str_tmp = str_tmp &"Const sys_tel = """& www56770com_sys_56770system(7) &""""&vbcrlf
				sys_tencent_qq = www56770com_sys_56770system(8)
				str_tmp = str_tmp &"Const lockip = """& www56770com_sys_56770system(9) &""""&vbcrlf
				str_sys_oicq = Split(sys_tencent_qq,"$$")
				str_tmp = str_tmp &"Const sys_oicq_x = """& str_sys_oicq(0) &""""&vbcrlf
				str_tmp = str_tmp &"Const sys_oicq_y = """& str_sys_oicq(1) &""""&vbcrlf
				str_tmp = str_tmp &"Const oicq_skin = """& str_sys_oicq(2) &""""&vbcrlf
				str_tmp = str_tmp &"Const oicq_zt = """& str_sys_oicq(3) &""""&vbcrlf
				str_tmp = str_tmp &"Const sys_oicq = """& www56770com_sys_56770system(17) &""""&vbcrlf
				str_tmp = str_tmp &"Const qq_zt = """& str_sys_oicq(5) &""""&vbcrlf
				str_tmp = str_tmp &"Const qq_wz = """& str_sys_oicq(6) &""""&vbcrlf
				str_tmp = str_tmp &"Const qq_ys = """& str_sys_oicq(7) &""""&vbcrlf
				str_tmp = str_tmp &"Const qq_show = """& str_sys_oicq(8) &""""&vbcrlf
				str_tmp = str_tmp &"Const Sys_description = """& trim(www56770com_sys_56770system(11)) &""""&vbcrlf
				str_tmp = str_tmp &"Const Sys_keywords = """& trim(www56770com_sys_56770system(12)) &""""&vbcrlf
				arr_sys_Upload = split(www56770com_sys_56770system(13),"$")
				str_tmp = str_tmp &"Const Upload_type = """& arr_sys_Upload(0) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_isDraw = """& arr_sys_Upload(1) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_Drawtext = """& arr_sys_Upload(2) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_Drawfontsize = """& arr_sys_Upload(3) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_Drawcolor = """& arr_sys_Upload(4) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_Drawfont = """& arr_sys_Upload(5) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_DrawFontBold = """& arr_sys_Upload(6) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_Drawpic = """& arr_sys_Upload(7) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_DrawGraph = """& arr_sys_Upload(8) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_Drawpiccolor = """& arr_sys_Upload(9) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_DrawXYType = """& arr_sys_Upload(10) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_DrawWidth = """& arr_sys_Upload(11) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_DrawHight = """& arr_sys_Upload(12) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_Dir = """& arr_sys_Upload(13) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_SPicWidth = """& arr_sys_Upload(14) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_SPicHeight = """& arr_sys_Upload(15) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_SaveType = """& arr_sys_Upload(16) &""""&vbcrlf
				str_tmp = str_tmp &"Const Upload_RName = """& arr_sys_Upload(17) &""""&vbcrlf
				str_tmp = str_tmp &"Const Sys_Logo = """& trim(www56770com_sys_56770system(14)) &""""&vbcrlf
				arr_skip_window = split(www56770com_sys_56770system(15),"$")
				str_tmp = str_tmp &"Const Sys_Skip_Window = """& arr_skip_window(0) &""""&vbcrlf
				str_tmp = str_tmp &"Dim Config_Lebi_Eshop"&vbcrlf
				str_tmp = str_tmp &"Const Arr_Config_Lebi_Eshop = """& www56770com_sys_56770system(10) &""""&vbcrlf
				str_tmp = str_tmp &"Config_Lebi_Eshop = Split(Arr_Config_Lebi_Eshop,""$"") "&vbcrlf
				str_tmp = str_tmp &"Const sys_ext = """& www56770com_sys_56770system(16) &""""&vbcrlf
				str_tmp = str_tmp &"Const Sys_kuaidi100 = """& www56770com_sys_56770system(18) &""""&vbcrlf
				str_tmp = str_tmp &"rem 以上变量由56770 Eshop网上开店系统（www.56770.com）自动生成"&vbcrlf
				str_tmp = str_tmp &"%\>"
				Savehtml "../include/Config"& LanguageTxt(LangT) &".Inc",str_tmp
		Next
		set Rs = conn.execute("select sys_sms from [Lebi_system]")
		arr_sys_sms = split(rs(0),"$")
		rs.close : Set rs=Nothing
		str_tmp = "<%"&vbcrlf
		str_tmp = str_tmp &"rem 以下变量由56770 Eshop网上开店系统（www.56770.com）自动生成"&vbcrlf
		str_tmp = str_tmp &"Const VCPServer = """& checknum(arr_sys_sms(7),0) &""""&vbcrlf
		str_tmp = str_tmp &"Const VCPServerPort = ""20002"""&vbcrlf
		str_tmp = str_tmp &"Const VCPUser = """& arr_sys_sms(0) &""""&vbcrlf
		str_tmp = str_tmp &"Const VCPPassword = """& arr_sys_sms(1) &""""&vbcrlf
		str_tmp = str_tmp &"Const VCPState = """& arr_sys_sms(5) &""""&vbcrlf
		str_tmp = str_tmp &"Const VCPMaxLen = """& arr_sys_sms(6) &""""&vbcrlf
		str_tmp = str_tmp &"rem 以上变量由56770 Eshop网上开店系统（www.56770.com）自动生成"&vbcrlf
		str_tmp = str_tmp &"%\>"
		SavehtmlGb2312 "../api/config.inc.asp",str_tmp
		On Error Resume Next
		If Err Then
		        Err.clear
                CreateConfig = "<font>["& Lang_sys(46) &"]</font>" & Err.Description
		End If
End Function
Function CheckDir(byval FolderPath)
        dim fso
		If IsNull(FolderPath) Or InStr(FolderPath,"//") > 0 Then 
				CheckDir = False 
				Exit Function 
		End If 
        folderpath=Server.MapPath(folderpath)
        Set fso = Server.CreateObject("Scripting.FileSystemObject")
        If fso.FolderExists(FolderPath) then
                CheckDir = True
        Else
                CheckDir = False
        End if
        Set fso = nothing
End Function
Function CheckDir2(byval FolderPath)
        dim fso
        folderpath=Server.MapPath(".")&"\"&folderpath
        Set fso = Server.CreateObject("Scripting.FileSystemObject")
        If fso.FolderExists(FolderPath) then
                CheckDir2 = True
        Else
                CheckDir2 = False
        End if
        Set fso = nothing
End Function
Function MakeNewsDir2(byval foldername)
        dim fso
        Set fso = Server.CreateObject("Scripting.FileSystemObject")
        fso.CreateFolder(Server.MapPath(".") &"\" &foldername)
        If fso.FolderExists(Server.MapPath(".") &"\" &foldername) Then
                MakeNewsDir2 = True
        Else
                MakeNewsDir2 = False
        End If
        Set fso = nothing
End Function
Function DefiniteUrl(Byval PrimitiveUrl,Byval ConsultUrl)
        Dim ConTemp,PriTemp,Pi,Ci,PriArray,ConArray
        If PrimitiveUrl="" or ConsultUrl="" or PrimitiveUrl="$False$" Then
                DefiniteUrl="$False$"
                Exit Function
        End If
        If Left(ConsultUrl,7)<>"HTTP://" And Left(ConsultUrl,7)<>"http://" Then
                ConsultUrl= "http://" & ConsultUrl
        End If
        ConsultUrl=Replace(ConsultUrl,"://",":\\")
        If Right(ConsultUrl,1)<>"/" Then
                If Instr(ConsultUrl,"/")>0 Then
                        If Instr(Right(ConsultUrl,Len(ConsultUrl)-InstrRev(ConsultUrl,"/")),".")>0 then
                        Else
                                ConsultUrl=ConsultUrl & "/"
                        End If
                Else
                        ConsultUrl=ConsultUrl & "/"
                End If
        End If
        ConArray=Split(ConsultUrl,"/")
        If Left(PrimitiveUrl,7) = "http://" then
                DefiniteUrl=Replace(PrimitiveUrl,"://",":\\")
        ElseIf Left(PrimitiveUrl,1) = "/" Then
                DefiniteUrl=ConArray(0) & PrimitiveUrl
        ElseIf Left(PrimitiveUrl,2)="./" Then
                DefiniteUrl=ConArray(0) & Right(PrimitiveUrl,Len(PrimitiveUrl)-1)
        ElseIf Left(PrimitiveUrl,3)="../" then
                Do While Left(PrimitiveUrl,3)="../"
                PrimitiveUrl=Right(PrimitiveUrl,Len(PrimitiveUrl)-3)
                Pi=Pi+1
                Loop
                For Ci=0 to (Ubound(ConArray)-1-Pi)
                        If DefiniteUrl<>"" Then
                                DefiniteUrl=DefiniteUrl & "/" & ConArray(Ci)
                        Else
                                DefiniteUrl=ConArray(Ci)
                        End If
                Next
                DefiniteUrl=DefiniteUrl & "/" & PrimitiveUrl
        Else
                If Instr(PrimitiveUrl,"/")>0 Then
                        PriArray=Split(PrimitiveUrl,"/")
                        If Instr(PriArray(0),".")>0 Then
                                If Right(PrimitiveUrl,1)="/" Then
                                        DefiniteUrl="http:\\" & PrimitiveUrl
                                Else
                                        If Instr(PriArray(Ubound(PriArray)-1),".")>0 Then
                                                DefiniteUrl="http:\\" & PrimitiveUrl
                                        Else
                                                DefiniteUrl="http:\\" & PrimitiveUrl & "/"
                                        End If
                                End If
                        Else
                                If Right(ConsultUrl,1)="/" Then
                                        DefiniteUrl=ConsultUrl & PrimitiveUrl
                                Else
                                        DefiniteUrl=Left(ConsultUrl,InstrRev(ConsultUrl,"/")) & PrimitiveUrl
                                End If
                        End If
                Else
                        If Instr(PrimitiveUrl,".")>0 Then
                                If Right(ConsultUrl,1)="/" Then
                                        If right(PrimitiveUrl,3)=".cn" or right(PrimitiveUrl,3)="com" or right(PrimitiveUrl,3)="net" or right(PrimitiveUrl,3)="org" Then
                                                DefiniteUrl="http:\\" & PrimitiveUrl & "/"
                                        Else
                                                DefiniteUrl=ConsultUrl & PrimitiveUrl
                                        End If
                                Else
                                        If right(PrimitiveUrl,3)=".cn" or right(PrimitiveUrl,3)="com" or right(PrimitiveUrl,3)="net" or right(PrimitiveUrl,3)="org" Then
                                                DefiniteUrl="http:\\" & PrimitiveUrl & "/"
                                        Else
                                                DefiniteUrl=Left(ConsultUrl,InstrRev(ConsultUrl,"/")) & "/" & PrimitiveUrl
                                        End If
                                End If
                        Else
                                If Right(ConsultUrl,1)="/" Then
                                        DefiniteUrl=ConsultUrl & PrimitiveUrl & "/"
                                Else
                                        DefiniteUrl=Left(ConsultUrl,InstrRev(ConsultUrl,"/")) & "/" & PrimitiveUrl & "/"
                                End If
                        End If
                End If
        End If
        If Left(DefiniteUrl,1)="/" then
                DefiniteUrl=Right(DefiniteUrl,Len(DefiniteUrl)-1)
        End if
        If DefiniteUrl<>"" Then
                DefiniteUrl=Replace(DefiniteUrl,"//","/")
                DefiniteUrl=Replace(DefiniteUrl,":\\","://")
        Else
                DefiniteUrl="$False$"
        End If
End Function
Function ReplaceSaveRemoteFile(ConStr,IncluL,IncluR,SaveTf,SaveFilePath,ThisUrl)
		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 request.ServerVariables("SERVER_PORT") <> 80 Then
				WebUrl = "http://"&Request.ServerVariables("SERVER_NAME")&":"&request.ServerVariables("SERVER_PORT")&"/"
		Else
				WebUrl = "http://"&Request.ServerVariables("SERVER_NAME")&"/"
		End If
        If ConStr="$False$" or ConStr="" or IsNull(ConStr) Then
                ReplaceSaveRemoteFile="$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
                ReplaceSaveRemoteFile=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),WebUrl)
				If InStr(RemoteFileurl,WebUrl)=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
						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
        ReplaceSaveRemoteFile=ConStr
End Function
Function CreatePath(PathValue)
		Dim objFSO,Fsofolder,uploadpath
		yy=year(Date()):mm=month(Date())
		if len(mm)=1 then mm="0"&mm
		uploadpath = yy&mm
		If Right(PathValue,1)<>"/" Then PathValue = PathValue&"/"
		On Error Resume Next
		Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		If objFSO.FolderExists(Server.MapPath(PathValue & uploadpath))=False Then
				objFSO.CreateFolder Server.MapPath(PathValue & uploadpath)
		End If
		If Err.Number = 0 Then
				CreatePath = PathValue & uploadpath & "/"
		End If
		Set objFSO = Nothing
End Function
Function RemoteFileCreatePath(PathValue)
		Dim objFSO,Fsofolder,uploadpath
		yy=year(Date()):mm=month(Date())
		if len(mm)=1 then mm="0"&mm
		uploadpath = yy&mm
		If Right(PathValue,1)<>"/" Then PathValue = PathValue&"/"
		On Error Resume Next
		Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		If objFSO.FolderExists(Server.MapPath(PathValue & uploadpath))=False Then
				objFSO.CreateFolder Server.MapPath(PathValue & uploadpath)
		End If
		If Err.Number = 0 Then
				RemoteFileCreatePath = PathValue & uploadpath & "/"
		End If
		Set objFSO = Nothing
End Function
sub SaveRemoteFile(LocalFileName,RemoteFileUrl)
		On Error Resume Next
        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(LocalFileName),2
        .Cancel()
        .Close()
        End With
        Set Ads=nothing
end sub
Function GetImg(str,strpath)
        set objregEx = new RegExp
        objregEx.IgnoreCase = true
        objregEx.Global = true
        objregEx.Pattern = "src=(.+?)\.(jpg|gif|png|bmp)"
        set matches = objregEx.execute(str)
        for each match in matches
                sImgone = sImgone & "|"& Match.Value
        next
        if sImgone<>"" then
                Imglist=split(sImgone,"|")(1)
'                Imgone=replace(Imgone,"src='","")
				Imgone=replace(Imglist,"src=""","")
				If Left(Imgone,1) = Eshop_url Then Imgone = Right(Imgone,Len(Imgone)-Len(Eshop_url))
				GetImg=Imgone
'				If Left(Imgone,"1") = "/" Then
'					GetImg=Imgone
'				Else
'					GetImg=strpath & Imgone
'				End If
        else
                GetImg=""
        end if
end function
Function getPicNewSize(sStr,pw,ph)
		Dim oldpw,oldph,pw_r,ph_r,newpw,newph
		newpw = 0
		newph = 0
		If instr(sStr,"|")>0 Then
				oldpw = CDbl(split(sStr,"|")(0))
				oldph = CDbl(split(sStr,"|")(1))
				pw_r = pw/oldpw
				ph_r = ph/oldph
				If pw_r > ph_r Then
						newpw = oldpw * ph_r
						newph = oldph * ph_r
				Else
						newpw = oldpw * pw_r
						newph = oldph * pw_r
				End If
		Else
				newpw = pw
				newph = ph
		End If
		 getPicNewSize = CInt(newpw)&"|"&CInt(newph)
End Function
rem	<-{ 数据下拉菜单 2008-3-12 by 56770.WangLei
Function dbHTMLSelect(mySql,showStr,valueStr,selectedStr)
		dim valStr,seledStr,optionStr,myRsSelect
		set myRsSelect = conn.execute(mysql)
		while not myRsSelect.eof
				if valueStr <> "" then
						valStr = "value="""&myRsSelect(valueStr)&""""
						if selectedStr <> "" and CStr(selectedStr)=CStr(myRsSelect(valueStr)) then
								seledStr = "selected"
						end if
				end if
				optionStr = optionStr & " <option "&valStr&" "&seledStr&">"&myRsSelect(showStr)&"</option> "
				valStr = ""
				seledStr = ""
				myRsSelect.movenext
		wend
		myRsSelect.close:set myRsSelect = nothing
		dbHTMLSelect = optionStr
End Function
Function ManageLog(info)
        url = Replace(LCase(Request.ServerVariables("SCRIPT_NAME")),"/"& LCase(AdminPath) &"/","")
		If Request.ServerVariables("QUERY_STRING")<>"" Then url=url&"?"& Request.ServerVariables("QUERY_STRING")
        Conn.execute("insert into [Lebi_manage_log](l_name,l_time,l_info,l_url)values('"& Eshop_Lebi_name &"',"& sqlnowstring &",'"& Left(info,100) &"','"& Left(url,100) &"')")
End Function
Sub OptionClass(a,b,c)
		sql="select classid,classname From [Lebi_newsclass] where ParentID  = "& a &" order by B_order desc"
		Set Rs1=Conn.Execute(sql)
		do while not rs1.eof
		If a = 0 Then
				Response.write("<option value='"& clng(rs1(0)) &"'")
		if InStr(c,","&rs1(0)&",")>0 Then Response.write("Selected")
				Response.write(">+ "& rs1(1) &"</option>")
		Else
				Response.write("<option value='"& clng(rs1(0)) &"'")
		If InStr(c,","&rs1(0)&",")>0 Then Response.write("Selected")
				Response.write(">"& tmp(b,"├ ") &" "& rs1(1) &"</option>")
		End If
		b=b+1
		OptionClass rs1(0),b,c
		b=b-1
		rs1.movenext
		loop
		rs1.Close : Set Rs1 = Nothing
End Sub
Sub OnlyReadMessage()
		Call Up_mes(Lang_sys(46),"·"& Lang_sys(93),0,"javascript:history.back();",0,0,3,0)
		response.End
End Sub
Sub Debug(str,stype)
		Response.Write(str)
		If stype = 1 Then Response.End
End Sub
Function NewEvent(etype)
		If UBound(Split(etype,",")) > 0 Then
				For i = 0 To UBound(Split(etype,","))
						Set sEvent = server.CreateObject("adodb.recordset")
						sEvent.open "select e_type from Lebi_Event where e_type = "& Split(etype,",")(i) &"",conn,1,3
						If sEvent.eof Then
								sEvent.addnew
								sEvent("e_type") = Split(etype,",")(i)
								sEvent.update
						End If
						sEvent.close : Set sEvent = Nothing
				Next
		Else
				Set sEvent = server.CreateObject("adodb.recordset")
				sEvent.open "select e_type from Lebi_Event where e_type = "& etype &"",conn,1,3
				If sEvent.eof Then
						sEvent.addnew
						sEvent("e_type") = etype
						sEvent.update
				End If
				sEvent.close : Set sEvent = Nothing
		End If
End Function
Function Splits(strBlock)
		If strBlock = "" Or IsNull(strBlock) Then Exit Function
		Dim strContent,strValue,strValuestr
		strContent = Replace(strBlock,"[[","'")
		strContent = Replace(strContent,"&#180;","'")
        Dim p_RegExp
        Set p_RegExp = New RegExp
		Dim objRegExp,objValue

		p_RegExp.ignorecase = True
		p_RegExp.global = True
		p_RegExp.pattern = "{\[(.+?)\]}"
		p_RegExp.pattern = "(<(script|link|img|input|embed|param|object|base|area|map|table|td|a|form).+?(href|src|background|action)=.+?)(.+?\>)"
		rem 2007-11-5 区分内外部连接URL by 56770.kingdge
		rem 2007-11-6 增加对https的识别 by 56770.kingdge
		Set objRegExp = p_RegExp.Execute(strContent)
		For Each objValue In objRegExp
			If instr(LCase(objValue.value),"http") = 0 And instr(LCase(objValue.value),"msnim:") = 0 And instr(LCase(objValue.value),"tencent:") = 0 And instr(LCase(objValue.value),"skype:") = 0 And instr(LCase(objValue.value),"wangwang:") = 0 Then
			        If ESHOP_URL = "/" Then
							strValue	= p_RegExp.Replace(objValue.value,"$1" & ESHOP_URL & "$4")
					Else
							strValue	= p_RegExp.Replace(Replace(objValue.value,ESHOP_URL,""),"$1" & ESHOP_URL & "$4")
					End If
					strContent = Replace(strContent,objValue.value,strValue)
			End If
		Next
		Set objRegExp = Nothing
		Splits = strContent
End Function
Function TplShowReplace(str)
		TplShowReplace = Replace(str,"[[","'")
		TplShowReplace = Replace(TplShowReplace,"&#180;","'")
End Function
Function QuickMenu(str1,str2)
		Dim prevurl,prevtext,nexturl,nexttext
		If str1 = "" Then
				prevurl = ""
				prevtext = ""
		Else
				prevurl = Split(str1,"|")(0)
				prevtext = Split(str1,"|")(1)
		End If
		If str2 = "" Then
				nexturl = ""
				nexttext = ""
		Else
				nexturl = Split(str2,"|")(0)
				nexttext = Split(str2,"|")(1)
		End If
		If str1 = "" And str2 = "" Then
				QuickMenu = "<input type=""image"" src="""& Eshop_url & AdminPath &"/images/bt_quick_back.gif"" border=""0"" alt="" "& Lang_sys(3) &" "" title="" "& Lang_sys(3) &" "" onclick=""location.href='javascript:history.back()';return false;"" align=""absmiddle"">"
				Exit Function
		End If
		QuickMenu = "<input type=""image"" src="""& Eshop_url & AdminPath &"/images/bt_quick_back.gif"" border=""0"" alt="" "& Lang_sys(3) &" "" title="" "& Lang_sys(3) &" "" onclick=""location.href='javascript:history.back()';return false;"" align=""absmiddle""> "
		If prevurl <> "" Then
				QuickMenu = QuickMenu &"<input type=""image"" src="""& Eshop_url & AdminPath &"/images/bt_quick_prev.gif"" border=""0"" alt="" "& prevtext &""" title="" "& prevtext &""" onclick=""location.href='"& prevurl &"';return false;"""
		Else
				QuickMenu = QuickMenu &"<input type=""image"" src="""& Eshop_url & AdminPath &"/images/bt_quick_prev_none.gif"" border=""0"" onclick=""return false;"""
		End If
		QuickMenu = QuickMenu &" align=""absmiddle"">"
		If nexturl <> "" Then
				QuickMenu = QuickMenu &"<input type=""image"" src="""& Eshop_url & AdminPath &"/images/bt_quick_next.gif"" border=""0"" alt="" "& nexttext &""" title="" "& nexttext &""" onclick=""location.href='"& nexturl &"';return false;"""
		Else
				QuickMenu = QuickMenu &"<input type=""image"" src="""& Eshop_url & AdminPath &"/images/bt_quick_next_none.gif"" border=""0"" onclick=""return false;"""
		End If
		QuickMenu = QuickMenu &" align=""absmiddle"">"
End Function
Function GetMaxNum(Arr_data)
        MaxNum = 0
		If Arr_data = "" Then Exit Function
		Arr = Split(Left(Arr_data,Len(Arr_data)-1),",")
        For i = 0 To ubound(Arr)
		        If CLng(Arr(i)) > CLng(MaxNum) Then
						MaxNum = Arr(i)
				End If
		Next
		GetMaxNum = MaxNum
End Function
Function CheckCopyright(Copyright)
		If InStr(Copyright,"56770.com") = 0 Then
				CheckCopyright = "<p style=""margin:0 auto; padding:5px; color:#999; font-size:11px; text-align:center;"">Powered by <a href='http://www.56770.com/' target='_blank' title='乐彼多语言网店系统(56770 Eshop)'><span style='color:#0954A6;font-weight:bold;'>56770</span> <span style='color:#FFA32B;font-weight:bold;'>EShop</span></a> <a href=""http://www.56770.com/download/"" target=""_blank""><span style=' font-size:11px;color:#999'>v"& copy_soft &"</span></a></p>"
		Else
				CheckCopyright = Copyright
		End If
End Function
Function include(filename)
		Dim re,content,fso,f,aspStart,aspEnd
		Set objStm = Server.CreateObject("ADODB.Stream")
			objStm.charset = "UTF-8"
			objStm.open
			objStm.LoadFromFile server.mappath(filename)
			content = objStm.Readtext
		Set objStm = Nothing
		set re=new RegExp
		re.pattern="^\s*="
		aspEnd=1
		aspStart=inStr(aspEnd,content,"<%")+2
		do while aspStart>aspEnd+1
		Response.write Mid(content,aspEnd,aspStart-aspEnd-2)
		aspEnd=inStr(aspStart,content,"%\>")+2
		Executeglobal(re.replace(Mid(content,aspStart,aspEnd-aspStart-2),"Response.Write "))
		aspStart=inStr(aspEnd,content,"<%")+2
		loop
		Response.write Mid(content,aspEnd)
		set re=nothing
End Function
Function CategoryList(id,ii)
		If id = 0 Then
				sql="select c_id,c_name,c_father,c_pic,c_order,c_pronum,c_menu,c_skin,is_hide,c_child,c_foldername from [lebi_category] where c_father=1"
		Else
				sql="select c_id,c_name,c_father,c_pic,c_order,c_pronum,c_menu,c_skin,is_hide,c_child,c_foldername from [lebi_category] where c_parentid="&id&""
		End If
		sql = sql &" order by c_order desc"
		IsMenudata = 0
		Set rs = conn.execute(Sql)
		If Not rs.eof Then
			menudata = rs.getrows()
			IsMenudata = 1
		End If
		rs.close : Set rs = Nothing
		If IsMenudata = 0 And id <> 0 Then
			Set rs = conn.execute("select c_parentid from [lebi_category] where c_id="& id &"")
			If Not rs.eof Then
				s_parent = rs(0)
			End If
			rs.close : Set rs = Nothing
			Set rs = conn.execute("select c_id,c_name,c_father,c_pic,c_order,c_pronum,c_menu,c_skin,is_hide,c_child,c_foldername from [lebi_category] where c_parentid="& s_parent &" order by c_order desc")
			If Not rs.eof Then
				menudata = rs.getrows()
				IsMenudata = 1
			End If
			rs.close : Set rs = Nothing
		End If
		If IsMenudata = 1 Then
			For mi = 0 To UBound(menudata,2)
				ChildCount=menudata(9,mi)
				If IsNull(ChildCount) Then ChildCount = 0
				if ChildCount=0 then
						CategoryStyle="cate_close"
						If menudata(2,mi)=1 Then CategoryStyle="cate_open"
						menuname=menudata(1,mi)
						onmouseup=""
				Else
						CategoryStyle="cate_open"
						if i=(UBound(menudata,2)+1) then
							If ii = 0 Then CategoryStyle="menu2"
						end If
						onmouseup=" onMouseUp=cate_change('a"&menudata(0,mi)&"','b"&menudata(0,mi)&"'); title=""展开"""
						menuname="<a href='?sort_id="&menudata(0,mi)&"'>"&menudata(1,mi)&"</a>"
				end If
				listtype="style='padding-left:"& 22 + (22 * ii) &"px;background-position:"& 22 * ii &"px 6px'"
				If ii = 0 Then CategoryStyle="cate_close"
				If sort_id <> 0 Then
						Change_order_upurl = "?action=up&sort_id="& menudata(0,mi) &"&c_id="& menudata(0,mi)
						Change_order_downurl = "?action=down&sort_id="& menudata(0,mi) &"&c_id="& menudata(0,mi)
				Else
						Change_order_upurl = "?action=up&c_id="& menudata(0,mi)
						Change_order_downurl = "?action=down&c_id="& menudata(0,mi)
				End If
				Response.Write("<tr class=""classrow""><td width=""5%"" height=""30"" class=""classrow"">")
				If ii = 0 And id = 0 Then
					Response.Write("<strong>"& menudata(0,mi) &"</strong>")
				Else
					Response.Write(menudata(0,mi))
				End If
				Response.Write("</td>")
				If ii = 0 Then
					Response.Write("<td width=""22%"" class=""classrow""><div id='b"& menudata(0,mi) &"' class='"& CategoryStyle &"'"& onmouseup &">")
				Else
					Response.Write("<td width=""22%"" class=""classrow""><div id='b"& menudata(0,mi) &"' class='"& CategoryStyle &"' "&listtype&""& onmouseup &">")
				End If
				Response.Write(menuname &"</div></td>")
				Response.Write("<td width=""8%"" class=""classrow"">")
				if trim(menudata(3,mi))<>"" then Response.Write("<img src=""../"& menudata(3,mi) &""" border=""0"" height=""30"" width=""30"">") Else Response.Write("&nbsp;") end If
				Response.Write("</td>")
				Response.Write("<td width=""8%"" class=""classrow"">")
				If menudata(8,mi) = 0 Then Response.Write("<font color=red>√</font>") Else Response.Write("×") End If
				Response.Write("</td>")
				Response.Write("<td width=""8%"" class=""classrow"">")
				If menudata(6,mi) = 1 Then Response.Write("<font color=red>√</font>") Else Response.Write("×") End If
				Response.Write("</td>")
				Response.Write("<td width=""8%"" class=""classrow"">"& menudata(5,mi) &"</td>")
				Response.Write("<td width=""8%"" class=""classrow"">"& menudata(4,mi) &"</td>")
				Response.Write("<td width=""8%"" class=""classrow""><input type=""image"" name=""up"" title=""↑"" onClick=""location.href='"& Change_order_upurl &"';return false;"" src=""images/icon_up.gif"" align=""absmiddle"">&nbsp;<input type=""image"" name=""down"" title=""↓"" onClick=""location.href='"& Change_order_downurl &"';return false;"" src=""images/icon_down.gif"" align=""absmiddle""></td>")
				Response.Write("<td width=""25%"" class=""classrow""><a href=""?id="& menudata(0,mi) &"&sort_id="& sort_id &"&action=add"">"& Lang_sys(5) &"</a> | <a href=""?id="& menudata(0,mi) &"&sort_id="& sort_id &"&action=modi"">"& Lang_sys(51) &"</a> | <a href=""?id="& menudata(0,mi) &"&sort_id="& sort_id &"&action=hb"">"& Lang_Sort(19) &"</a> | <a href=""?id="& menudata(0,mi) &"&sort_id="& sort_id &"&action=del"" onClick=""return confirm('"& Lang_sys(64) &"')"">"& Lang_sys(15) &"</a>")
				If menudata(7,mi) <> "" Then Response.Write(" | <a href=""?skin="& menudata(7,mi) &"&action=skin&id="& menudata(0,mi) &"&sort_id="& sort_id &""">"& Lang_Sort(20) &"</a>")
				Response.Write(" | <a target=""_blank"" href=""")
				If Config_Lebi_Eshop(16) = 0 Then
				Response.Write("../showsort.asp?id="& menudata(0,mi) &"")
				Else
				Response.Write("../category/"& menudata(10,mi) &"/")
				End If
				Response.Write(""">"& Lang_sys(59) &"</a>")
				Response.Write("</td>")
				Response.Write("</tr>"&chr(13))
				if ChildCount>0 Then
						If ii = 0 Then
								Response.Write("<tr id='a"&menudata(0,mi)&"' style='display:'>")
						Else
								Response.Write("<tr id='a"&menudata(0,mi)&"' style='display:none'>")
						End If
						Response.Write("<td colspan=""9""><table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&chr(13))
						CategoryList menudata(0,mi),ii+1
						Response.Write("</table></td></tr>"&chr(13))
				end if
			Next
		End If
End Function
Function GetPageNum(num,pagenum)
		GetPageNum = "<div class=""pagenum"">"
		If CLng(pagenum) = CLng(num) Then
			GetPageNum = GetPageNum &"<span class=""page-cur"">"& num &"</span>"
		Else
			GetPageNum = GetPageNum &"<a href="""& GetPageNumURL(num) &""" title="""& Lang_Page(7) &""">"& num &"</a>"
		End If
		If CLng(pagenum) = CLng(num*2) Then
			GetPageNum = GetPageNum &"<span class=""page-cur"">"& num*2 &"</span>"
		Else
			GetPageNum = GetPageNum &"<a href="""& GetPageNumURL(num*2) &""" title="""& Lang_Page(7) &""">"& num*2 &"</a>"
		End If
		If CLng(pagenum) = CLng(num*3) Then
			GetPageNum = GetPageNum &"<span class=""page-cur"">"& num*3 &"</span>"
		Else
			GetPageNum = GetPageNum &"<a href="""& GetPageNumURL(num*3) &""" title="""& Lang_Page(7) &""">"& num*3 &"</a>"
		End If
		GetPageNum = GetPageNum &"</div>"
End Function
Function GetPageNumURL(num)
		Dim strurl,str_url,i,j,search_str,result_url,str_params
		num = checknum(num,0)
		search_str="pagenum="
		strurl=Request.ServerVariables("URL")
		Strurl=split(strurl,"/")
		i=UBound(strurl,1)
		str_url="" 'strurl(i)'得到"& Lang_Page(6) &"文件名
		str_params=Trim(Request.ServerVariables("QUERY_STRING"))
		If str_params="" Then
				Select Case num
					   Case "0" : result_url=str_url
					   Case Else
							result_url=str_url & "?pagenum="& num
				End Select
		Else
				If InstrRev(str_params,search_str)=0 Then
						Select Case num
							   Case "0" : result_url=str_url & "?" & str_params
							   Case Else
									result_url=str_url & "?" & str_params &"&pagenum="& num
						End Select
				Else
						j=InstrRev(str_params,search_str)-2
						If j=-1 Then
								Select Case num
									   Case "0" : result_url=str_url
									   Case Else
											result_url=str_url & "?pagenum="& num
								End Select
						Else
								str_params=Left(str_params,j)
								Select Case num
									   Case "0" : result_url=str_url & "?" & str_params
									   Case Else
											result_url=str_url & "?" & str_params &"&pagenum="& num
								End Select
						End If
				End If
		End If
		If result_url = "" Then result_url = "?"
		GetPageNumURL=result_url
End Function
Function GetLicenseData(key,license)
		On Error Resume Next
		Dim objStream,ConnLicense
		Set objStream = Server.CreateObject("ADODB.Stream")
		objStream.Open : objStream.Type=1 : objStream.LoadFromFile server.MapPath(Eshop_url&"Include/lebi_license/"& license &".license")
		Set ConnLicense = Server.CreateObject("ADODB.Connection")
		ConnLicense.open "Provider = Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password="&left(objStream.Read,19)&";Data Source="& Server.MapPath(Eshop_url&"Include/lebi_license/"& key &".key")
		If Err Then
				err.Clear : Set ConnLicense = Nothing : Response.End
		End If
		Set rs = ConnLicense.execute("select a,c from [56770_license]")
		GetLicenseData = rs(1) &"$$$"& rs(0)
		rs.close : Set rs = Nothing
End Function
Function CheckNewVersion()
		Dim RanNum
		Randomize
		RanNum = Int(9000000*rnd)+1000000
		ServerUrl = "http://www.56770.com/autoupgrade/"
		CheckNewVersion = 0
		session("CheckNewVersion") = 0
		LocalVersion = Replace(LoadFile(Eshop_url &"include/Upgrade.inc"),".","")
		url = ServerUrl & "Upgrade.asp?utype=check&RanNum="& RanNum
		ServerVersion = Replace(getpage(url),".","")
		If CLng(LocalVersion) < CLng(checknum(ServerVersion,0)) Then
				CheckNewVersion = 1
				session("CheckNewVersion") = 1
		End If
End Function
Function getpage(url)
		set xmlhttp=server.createobject("Microsoft.XMLHTTP")
		xmlhttp.open "get",url,False
		xmlhttp.send
		On Error Resume Next
		If xmlhttp.status<>200 Then
				getpage="0"
		Else
				getpage=bytes2BSTR(xmlhttp.ResponseBody)
		End If
End Function
Function bytes2BSTR(vIn)
		dim strReturn
		dim i,ThisCharCode ,NextCharCode
		strReturn = ""
		For i = 1 To LenB(vIn)
				ThisCharCode = AscB(MidB(vIn,i,1))
				If ThisCharCode < &H80 Then
						strReturn = strReturn & Chr(ThisCharCode )
				Else
						NextCharCode = AscB(MidB(vIn,i+1,1))
						strReturn = strReturn & Chr(CLng(ThisCharCode ) * &H100 + CInt(NextCharCode ))
						i = i + 1
				End If
		Next
		bytes2BSTR = strReturn
End Function
Function GetHttp(U)
		On Error Resume Next
		If Lcase(Left(U,7))<>"http://" Then Exit Function
		Set D=Server.CreateObject("Microsoft.XMLHTTP"):D.Open "GET",U,false:D.send
		If D.status=200 Then GetHttp=D.ResponseBody
		Set D=Nothing
End Function
Function SaveAs(B,P)
		On Error Resume Next
		Set D=server.createobject("ADODB.Stream"):D.type=1:D.Mode=3:D.Open:D.Write B
		If D.size>0 Then D.SaveToFile P,2:ErrN=0:
		D.Close:Set D=nothing
End Function
Function UnPack(file)
	   On Error Resume Next 
	   str = Server.MapPath("../") &"\"
	   Set rs = CreateObject("ADODB.RecordSet")
	   Set stream = CreateObject("ADODB.Stream")
	   Set conn = CreateObject("ADODB.Connection")
	   connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../"& file)
	   conn.Open connStr
	   rs.Open "FileData", conn, 1, 1
	   stream.Open
	   stream.Type = 1
	   UnPack = 0
	   Do Until rs.Eof
				If InStr(LCase(rs("P")),"update\default.asp") > 0 Then
						UnPack = UnPack + 1
				End If
				theFolder = Left(rs("P"), InStrRev(rs("P"), "\"))
				If AutoCreateFolder(str & theFolder) Then
'						 response.write str & theFolder
'						 oFso.CreateFolder(str & theFolder)
				End If
				stream.SetEOS()
				If IsNull(rs("fileContent")) = False Then stream.Write rs("fileContent")
				stream.SaveToFile str & rs("P"), 2
				rs.MoveNext
	   Loop
	   rs.Close
	   conn.Close
	   stream.Close
	   Set ws = Nothing
	   Set rs = Nothing
	   Set stream = Nothing
	   Set conn = Nothing
End Function
Function AutoCreateFolder(strPath) 'As Boolean 
        On Error Resume Next 
        Dim astrPath, ulngPath, i, strTmpPath 
        Dim objFSO 
        If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then 
                AutoCreateFolder = False 
                Exit Function 
        End If 
        Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 
        If objFSO.FolderExists(strPath) Then 
                AutoCreateFolder = True 
                Exit Function 
        End If 
        astrPath = Split(strPath, "\") 
        ulngPath = UBound(astrPath) 
        strTmpPath = "" 
        For i = 0 To ulngPath 
                strTmpPath = strTmpPath & astrPath(i) & "\" 
                If Not objFSO.FolderExists(strTmpPath) Then 
                        '创建 
                        objFSO.CreateFolder(strTmpPath) 
                End If 
        Next 
        Set objFSO = Nothing 
        If Err = 0 Then 
                AutoCreateFolder = True 
        Else 
                AutoCreateFolder = False 
        End If 
End Function 
Function ReplaceFolder(Str)
	    If Isnull(Str) Then
	    	    Safereplace = ""
	    	    Exit Function
	    End If
	    Str = Replace(Trim(Str),"*","")
	    Str = Replace(Str,"?","")
	    Str = Replace(Str,"""","")
        Str = Replace(Str,"\","")
        Str = Replace(Str,"/","")
	    Str = Replace(Str,"|","")
        Str = Replace(Str,":","")
	    Str = Replace(Str,"<","")
	    Str = Replace(Str,">","")
	    ReplaceFolder = Str
End Function
Function copyfile(startfile,tofile)
		Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
		If MyFileObject.FolderExists(startfile) Or MyFileObject.FolderExists(tofile) Then  
				Exit Function 
		End If 
		Set MyFolder=MyFileObject.GetFolder(startfile)
		domain=Split(startfile,"\")(UBound(Split(startfile,"\")))
		For Each thing in MyFolder.Files
				s=Split(thing,"\")
				a=UBound(s)
				s3=Split(thing,"\")(a)
				MyFileObject.CopyFile thing,tofile&"\"&s3
		Next
		For Each thing in MyFolder.SubFolders
				s=Split(thing,"\")
				a=UBound(s)
				s3=Split(thing,"\")(a)
				MyFileObject.copyFolder thing,tofile&"\"&s3
		Next
End Function 
Function CheckBianhao(str,id,ctype,dbtype)
		DataCount = 1
		str = safereplace(str)
		id = checknum(id,0)
		Select Case dbtype
		Case "0" tablename = "Lebi_product"
		Case "1" tablename = "Lebi_product_unite"
		End Select 
		sql = "select top 1 bianhao from ["& tablename &"] where bianhao='"& str &"'"
		If ctype = 1 Then sql = sql &" and id <> "& id &""
		Set rsCheckBianhao = conn.execute(sql)
		If rsCheckBianhao.eof Then
				DataCount = 0
		End If 
		rsCheckBianhao.close : Set rsCheckBianhao = Nothing 
		If DataCount = 1 Then 
				str = str &"-1"
				CheckBianhao = CheckBianhao(str,id,ctype,dbtype)
		Else
				CheckBianhao = str
				Exit Function 
		End If
End Function 
Function getN(str,keyword,splits) 
		getN = 0 
		arr = Split(str,splits) 
		getN = UBound(arr) 
		For n = 0 To UBound(arr) 
		if CStr(arr(n)) = CStr(keyword) then 
				getN = (n-1) + 1 
				Exit Function  
		End If  
		Next  
End Function 
Function Kuadi100API(com,nu,valicode)
	If Split(sys_kuaidi100,"|")(0) = 1 Then 
		SendURL = "http://api.kuaidi100.com/api?id="& Split(sys_kuaidi100,"|")(1) &"&com="& safereplace(com) &"&nu="& safereplace(nu) &"&valicode="& safereplace(valicode) &"&show=2&muti=1&order=asc"
		Kuadi100API = GetHTTPPage(SendURL)
	End If 
End Function 
Function GetHTTPPage(URL) 
    Dim objXML 
    Set objXML=CreateObject("MSXML2.SERVERXMLHTTP.3.0")  '调用XMLHTTP组件，测试空间是否支持XMLHTTP，如果服务不支持，请测试下面两个。
	'Set objXML=Server.CreateObject("Microsoft.XMLHTTP") 
	'Set objXML=Server.CreateObject("MSXML2.XMLHTTP.4.0") 
	objXML.SetTimeouts 5000, 5000, 30000, 10000' 解析DNS名字的超时时间，建立Winsock连接的超时时间，发送数据的超时时间，接收response的超时时间。单位毫秒
    objXML.Open "GET",URL,False 'false表示以同步的方式获取网页代码，了解什么是同步？什么是异步？
    objXML.Send() '发送
	If objXML.Readystate<>4 Then
		Exit Function 
	End If
	'Readystate属性,传回XML文件资料的目前状况,返回值分别有以下：
	'0-UNINITIALIZED：XML 对象被产生，但没有任何文件被加载。
	'1-LOADING：加载程序进行中，但文件尚未开始解析。
	'2-LOADED：部分的文件已经加载且进行解析，但对象模型尚未生效。
	'3-INTERACTIVE：仅对已加载的部分文件有效，在此情况下，对象模型是有效但只读的。
	'4-COMPLETED：文件已完全加载，代表加载成功。
	'GetHTTPPage=objXML.ResponseBody
	GetHTTPPage=BytesToBstr(objXML.ResponseBody)'返回信息，同时用函数定义编码，如果您需要转码请选择 
    Set objXML=Nothing'关闭 
	If Err.number<>0 Then 
		Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错，请稍后再试！</b></font></p>" 
		Err.Clear
	Else
		GetHTTPPage = GetHTTPPage &"<span style=""font-size:12px"">查询数据由：快递100(<a href='http://kuaidi100.com' target='_blank'>www.kuaidi100</a>) 提供</span>"
	End If
End Function
Function BytesToBstr(body) 
	On Error Resume Next 
	If IsNull(body) Then 
		BytesToBstr = ""
		Exit Function 
	End If 
    Dim objstream 
    Set objstream = Server.CreateObject("Adodb.Stream") '//调用adodb.stream组件
    objstream.Type = 1 
    objstream.Mode =3 
    objstream.Open 
    objstream.Write body 
    objstream.Position = 0 
    objstream.Type = 2 
    objstream.Charset = "UTF-8" '转换原来默认的编码转换成GB2312编码，否则直接用XMLHTTP调用有中文字符的网页得到的将是乱码 
    BytesToBstr = objstream.ReadText 
    objstream.Close 
    Set objstream = Nothing 
End Function
Function CheckUrl(url)
	If InStr(url,"http") = 0 Then
		CheckUrl = url
	Else
		If InStr(url,"http://"& Request.ServerVariables("SERVER_NAME")) > 0 Then 
			CheckUrl = url
		Else
			CheckUrl = ""
			Exit Function 
		End If 
	End If 
End Function 
Function MoveSave(Rstr)
	Dim i,SpStr
	SpStr = Split(Rstr,"|")
	For i = 0 To Ubound(Spstr)
		If instr("|"& MoveSave &"|","|"& SpStr(i) &"|") = 0 Then
			MoveSave = MoveSave & SpStr(i)
			If CLng(i) < CLng(Ubound(Spstr)) And CLng(Ubound(Spstr)) > 0 Then MoveSave = MoveSave & "|"
		End If
	Next
	If Right(MoveSave,1) = "|" Then MoveSave = CutText(MoveSave,0,1)
End Function
Function Urlencode(str)
		If IsNull(str) Then
				Exit Function
		End If
		Urlencode = server.urlencode(str)
End Function
%>