发信人: java.jsp(bliou)
整理人: i_am_trueman(2003-10-22 17:00:59), 站内信件
|
【 在 lailongjun 的大作中提到:】
:如题
:......
原封不动,则有可能被脚本攻击
我给你一段代码,可以屏蔽
function htmlencode(str)
dim result
dim l
if isNULL(str) then
htmlencode2=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
select case mid(str,i,1)
case chr(13)
result=result+"<br>"
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(32)
'result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
case chr(9)
result=result+" "
case else
result=result+mid(str,i,1)
end select
if i mod 8=0 then
result=result+"<br>"
end if
next
while instr(result,"<script")<>0
result=replace(result,"<script","<script")
result=replace(result,"</script>","</script>")
wend
htmlencode=result
end function
---- 网上电脑超市开张了,欢迎大家光临
如果您正准备买物美价廉的电脑,那么请您来
如果您准备在网上拓宽电脑销售空间,那么您也可以来
如果您无所事事,我这里正需要您
QQ:787495
|
|