收集asp的常用函数
(编辑:jimmy 日期: 2024/11/8 浏览:3 次 )
复制代码 代码如下:
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")
HTMLEncode = fString
end if
end function
Function Safe(str)'该函数用来判断传递过来的变量是否包含特殊字符,没有返回TRUE
Dim s_BadStr, n, i
s_BadStr = "' &<>?%,;:()`~!@#$^*{}[]|\/+-="&Chr(34)&Chr(9)&Chr(32)
n = Len(s_BadStr)
Safe = True
For i = 1 To n
If Instr(str, Mid(s_BadStr, i, 1)) > 0 Then
Safe = False
Exit Function
End If
Next
End Function
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
fString = Replace(fString, CHR(10), "<BR> ")
HTMLEncode = fString
end if
end function
Function Safe(str)'该函数用来判断传递过来的变量是否包含特殊字符,没有返回TRUE
Dim s_BadStr, n, i
s_BadStr = "' &<>?%,;:()`~!@#$^*{}[]|\/+-="&Chr(34)&Chr(9)&Chr(32)
n = Len(s_BadStr)
Safe = True
For i = 1 To n
If Instr(str, Mid(s_BadStr, i, 1)) > 0 Then
Safe = False
Exit Function
End If
Next
End Function
下一篇:改进一下asp自带的formatNumber函数