复制代码 代码如下:
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
申明:本教程内容由威凡网编辑整理并提供IT程序员分享学习,如文中有侵权行为,请与站长联系(QQ:254677821)!