收集asp的常用函数
程序员文章站
2023-01-25 14:16:16
复制代码 代码如下:function htmlencode(fstring) if not isnull(fstring) then...
复制代码 代码如下:
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
上一篇: 你知道中秋节为什么吃月饼吗
下一篇: 奶酪怎么吃既简单又美味