收集asp的常用函数
程序员文章站
2022-05-28 16:05:57
复制代码 代码如下: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
上一篇: ASP 无限级分类实现
下一篇: 表头固定,表的主体设置滚动条