⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.asp

📁 电子商城代码
💻 ASP
字号:
<%
'****************************************************
'过滤非法字段
'****  Start  ************************************************************************************************************************
'Function Safereplace(str)
'	    Safereplace = Replace(Replace(Replace(Trim(str), "'", "’"), Chr(34), ""), ";", "")
'End Function


Public Function Safereplace(Str)
            'dim str
	    If Isnull(Str) Then
	    	    Safereplace = ""
	    	    Exit Function 
	    End If
	    Str = Replace(Str,"'","''")
            Str = Replace(Str,"<","&lt;")
            Str = Replace(Str,">","&gt;")
	    Str = Replace(Str,"%","%")
	    Safereplace = Str
End Function
'****  End   *************************************************************************************************************************

'过滤非法字段
'****  Start  ************************************************************************************************************************
'Function Safereplace(str)
'	    Safereplace = Replace(Replace(Replace(Trim(str), "'", "’"), Chr(34), ""), ";", "")
'End Function

Public Function change(Str)
	    Str = Replace(Str,"{","<%=")
	    Str = Replace(Str,"]","%")
		Str = Replace(Str,"}",">")
	    change = Str
End Function
'****  End   *************************************************************************************************************************

Public function judge(a,b)
        dim res 
        if instr(a,b)>0 then
                res ="checked"
        end if
        judge = res
end Function

Public function judge2(a,b)
        dim res 
        if instr(a,b)>0 then
               res ="selected"
        end if
        judge2= res
end Function

rem 日期格式化函数
rem 2006-2-3 56770.kingdge
Public 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 

rem 获取当前URL地址
rem 2006-3-13 56770.kingdge
Public Function Backurl()
	   Backurl="http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables("URL")
	   If Request.ServerVariables("QUERY_STRING")<>"" Then Backurl=Backurl&"?"& Request.ServerVariables("QUERY_STRING")
End Function
'***********************************************
'函数名:JoinChar
'作  用:向地址中加入 ? 或 &
'参  数:strUrl  ----网址
'返回值:加了 ? 或 & 的网址
'***********************************************
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
'***************************************************
'函数名:IsObjInstalled
'作  用:检查组件是否已经安装
'参  数:strClassString ----组件名
'返回值:True  ----已经安装
'       False ----没有安装
'***************************************************
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
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -