www.gusucode.com > 云枫企业网站源代码第二版 2.0源码程序 > admin/inc/PubCls.asp
<% function GetProdUrlT(P_Class) dim RS select case P_Class case "1" RS = "F-Products/F-PDP_Show.asp" case "21" RS = "F-Products/F-CRT_Show.asp" case "22" RS = "F-Products/F-CRT_Show.asp" case "23" RS = "F-Products/F-CRT_Show.asp" case "24" RS = "F-Products/F-CRT_Show.asp" case "31" RS = "F-Products/F-CRT_Show.asp" case "32" RS = "F-Products/F-CRT_Show.asp" case "33" RS = "F-Products/F-CRT_Show.asp" case "34" RS = "F-Products/F-CRT_Show.asp" case "4" RS = "F-Products/F-ppdl_show.asp" case "5" RS = "F-Products/F-CRT_Show.asp" case "61" RS = "F-sun/ProdShow.asp" case "62" RS = "F-sun/ProdShow.asp" case "63" RS = "F-sun/ProdShow.asp" case "64" RS = "F-sun/ProdShow.asp" end select GetProdUrlT = RS end function function GetProdUrlC(P_Class) dim RS select case P_Class case "1" RS = "Products/PDPShow.asp" case "21" RS = "Products/CRT_Show.asp" case "22" RS = "Products/CRT_Show.asp" case "23" RS = "Products/CRT_Show.asp" case "24" RS = "Products/CRT_Show.asp" case "31" RS = "Products/CRT_Show.asp" case "32" RS = "Products/CRT_Show.asp" case "33" RS = "Products/CRT_Show.asp" case "34" RS = "Products/CRT_Show.asp" case "4" RS = "Products/ppdl_show.asp" case "5" RS = "Products/CRT_Show.asp" case "61" RS = "sun/products/ProdShow.asp" case "62" RS = "sun/products/ProdShow.asp" case "63" RS = "sun/products/ProdShow.asp" case "64" RS = "sun/products/ProdShow.asp" end select GetProdUrlC = RS end function function GetP_Class_English(P_Class) dim RS select case P_Class case "0" RS = "Plasma TV" case "1" RS = "LCD monitors" case "2" RS = "CRT monitors" case "3" RS = "PC Peripherals" end select GetP_Class_English = RS end function function GetEnglishClass(ClassId) dim RS RS = "" set rs_EnglishClass = conn.execute("select TypeNameEng from TypeEnglish where Id = "&ClassId&"") if not rs_EnglishClass.eof then RS = rs_EnglishClass("TypeNameEng") end if rs_EnglishClass.close set rs_EnglishClass = nothing GetEnglishClass = RS end function function GetP_Class(P_Class) dim RS select case P_Class case "1" RS = "PDP等离子" case "21" RS = "CRT系列-HPC" case "22" RS = "CRT系列-HPC.名匠" case "23" RS = "CRT系列-NPT" case "24" RS = "CRT系列-OEM" case "31" RS = "LCD系列-HPC" case "32" RS = "LCD系列-HPC.名匠" case "33" RS = "LCD系列-NPT" case "34" RS = "LCD系列-OEM" case "4" RS = "品牌机系列" case "5" RS = "外设产品" case "61" RS = "阳光产品-机箱" case "62" RS = "阳光产品-键盘鼠标" case "63" RS = "阳光产品-显示器" case "64" RS = "阳光产品-主板显卡" end select GetP_Class = RS end function function GetCommFlag(CommFlag) dim RS select case CommFlag case "0" RS = "<font color='red'>推荐</font>" case "1" RS = "普通" end select GetCommFlag = RS end function function GetAudFlag(CommFlag) dim RS select case CommFlag case "0" RS = "通过" case "1" RS = "<font color='red'>待审核</font>" case "2" RS = "<font color='bule'>不通过</font>" end select GetAudFlag = RS end function '*************************************************************************************** 'Javascript脚本提示函数 * '调用方法:call ShowInfo("请登录后再使用!","location.href='javascript:history.back();'")* '*************************************************************************************** sub ShowInfo(info1,info2) Response.Write "<script language='javascript'>"&vbcrlf Response.Write "alert('"&info1&"');"&vbcrlf Response.Write info2 & vbcrlf Response.Write "</script>"&vbcrlf Response.end end sub Function ShowName(FieldShow,TableName,FieldId,NameId) sql="select "&FieldShow&" from "&TableName&" where "&FieldId&"='"&NameId&"'" 'set Rs_Name = server.createobject("adodb.recordset") 'Rs_Name.open sql,conn,3,3 set Rs_Name = conn.execute(sql) if not Rs_Name.eof then ShowName = Rs_Name(FieldShow) end if Rs_Name.close set Rs_Name = nothing End Function function html(str) on error resume next dim result dim l if isnull(str) then html="" exit function end if l=len(str) result="" dim i for i = 1 to l select case mid(str,i,1) case "[img]" result=result+"<img src=" case "[/img]" result=result+" >" case "[b]" result=result+"<b>" case "[/b]" result=result+"</b>" case "[f]" result=result+"<font " case "[/f]" result=result+"</font>" case chr(34) result=result+""" case "&" result=result+"&" case "<" result=result+"<" case ">" result=result+">" case "'" result=result+"’" case chr(13) result=result+"<br>" case chr(9) result=result+" "'+" " case chr(32) if i+1<=l and i-1>0 then if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then result=result+" " else result=result+" " end if else result=result+" "'" " end if case else result=result+mid(str,i,1) end select next if err.number<>0 then err.clear html=result end function '************************************************************************************* '特殊字符转义反处理 * '调用方法:field=UnHtml(field) * '************************************************************************************* function UnHtml(strInput) if isnull(strInput) then UnHtml="" exit function end if dim sstrResult sstrResult = strInput sstrResult = Replace(sstrResult,"<br>",chr(13)) sstrResult = Replace(sstrResult," "," ") sstrResult = Replace(sstrResult,"’","'") sstrResult = Replace(sstrResult,""",chr(34)) sstrResult = Replace(sstrResult,"&","&") UnHtml = sstrResult end function function HtmlNew(strInput) if isnull(strInput) then UnHtml="" exit function end if dim sstrResult sstrResult = strInput sstrResult = Replace(sstrResult,"'","’") HtmlNew = sstrResult end function '---------------------- ' 获得最大ID的函数 '---------------------- function GetMaxId(TableName,Feild) dim IntId set RsMax = conn.execute("select Max("&Feild&") from "&TableName&"") if not RsMax.eof then IntId = RsMax(0)+1 if Len(IntId)=1 then GetMaxId="00"&cstr(IntId+1) elseif len(IntId)=2 then GetMaxId="0"&cstr(IntId+1) elseif len(IntId)=3 then GetMaxId=cstr(IntId+1) end if else GetMaxId = 0 end if RsMax.close set RsMax = nothing end function '---------------------- ' 列出信息左X位 '---------------------- function GetLeftStr(Str,StrLen) dim i,j,TepStr,TolStr TolStr="" j=1 if len(str)>0 then if len(str)>StrLen then for i=1 to StrLen TepStr=asc(mid(Str,j,1)) if TepStr < 0 then TepStr=TepStr+65536 if TepStr > 255 then TolStr=TolStr&mid(Str,j,1) j=j+1 else TolStr=TolStr&mid(Str,j,1) j=j+1 TepStr=asc(mid(Str,j,1)) TolStr=TolStr&mid(Str,j,1) j=j+1 end if next GetLeftStr=TolStr&"..." else GetLeftStr=Str end if else GetLeftStr="" end if end function '---------------------- ' 获得产品类型ID的函数 '---------------------- function GetTypeId() GetTypeId=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now) end function '------------------------ ' 获得某类型下的所有类型ID '------------------------ ' function GetLastId(TypeId) dim RsLast,LastId LastId="" set RsLast = conn.execute("select TypeId from TypeData where TypeFather='"&TypeId&"'") if not RsLast.eof then do while not RsLast.eof LastId="'"&RsLast("TypeId")&"',"&LastId RsLast.MoveNext loop GetLastId = left(LastId,len(LastId)-1) else GEtLastId = "" end if RsLast.close set RsLast = nothing end function '---------------------------- ' 由产品类别Id获得类别名称 '---------------------------- function GetTypeName(TypeId) dim rs,strTypeName 'response.Write("select TypeNameCha,TypeNameEng from TypeBil where Id='"&TypeId&"'") set rs = conn.execute("select TypeNameCha from TypeBil where Id="&TypeId&"") if not rs.eof then strTypeName = rs("TypeNameCha") else strTypeName = "" end if GetTypeName = strTypeName end function '---------------------------- ' 由产品类别Id获得类别名称 '---------------------------- function GetTypeNameEng(TypeId) dim rs,strTypeName 'response.Write("select TypeNameCha,TypeNameEng from TypeBil where Id='"&TypeId&"'") set rs = conn.execute("select TypeNameEng from TypeBil where Id="&TypeId&"") if not rs.eof then strTypeName = rs("TypeNameEng") else strTypeName = "" end if GetTypeNameEng = strTypeName end function '------------------------------- ' 由产品ID获得产品名称 '------------------------------- function GetProdName(TypeId,LangFalg) dim rs,strTypeName set rs = conn.execute("select TypeNameChina,TypeNameEnglish from TypeData where TypeId='"&TypeId&"'") if not rs.eof then if LangFlag="0" then strTypeName = rs("TypeNameChina") elseif LangFlag="1" then strTypeName = rs("TypeNameEnglish") else strTypeName = "" end if end if GetTypeName = strTypeName end function function GetOrderId() GetOrderId = "ZH-"&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now) end function %>