当前位置:首页 > ASP教程 > 应用技巧

收集asp的常用函数

复制代码 代码如下:

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 


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!