急...................表单过滤程序有问题,高手请进来,谢谢!
vbscript吧
全部回复
仅看楼主
level 1
源程序<%dim incept(),send()x=5y=xincept(0)=CStr(request.form("Name"))incept(1)=CStr(request.form("Mail"))incept(2)=CStr(request.form("Home"))incept(3)=CStr(request.form("Caption"))incept(x-1)=CStr(request.form("Text"))if len(incept(x-1))>300 then incept(x-1)=left(incept(x-1),300)if incept(1)="" or incept(1)="30字符内" then incept(1)="empty"if incept(2)="" or incept(2)="30字符内" then incept(2)="empty"else if left(incept(2),7)<>"http://" then incept(2)="http://" + incept(2)end iffor i=1 to x if incept(y-x)<>"empty" then s=len(incept(y-x))n=s+1for j=1 to s m=mid(incept(y-x),n-s,1) if m=" " then send(y-x)=send(y-x) + " "y=y+1n=n+1 else if m=chr(62) then send(y-x)=send(y-x) + ">" y=y+1 n=n+1else if m=chr(60) then send(y-x)=send(y-x) + "<"y=y+1n=n+1 else if m=chr(34) then send(y-x)=send(y-x) + """ y=y+1 n=n+1else if m=chr(38) then send(y-x)=send(y-x) + "&"y=y+1n=n+1 else send(y-x)=send(y-x) + my=y+1n=n+1 end ifend if end ifend if end ifnext else send(y-x)=incept(y-x)y=y+1 end ifnext%><%=send(0)%>
<%=send(1)%>
<%=send(2)%>
<%=send(3)%>
<%=send(4)%>可能是定义数组那出了点问题。还有在for循环里if语句判断的时候,这句话send(y-x)=send(y-x) + "这里的东西我都是用html转义符写的",百度输出的是后有点毛病。——发现个BUG哈哈。 
2007年06月05日 04点06分 1
level 0
<%function sift(nr,s) n=s+1 for y=1 to s m=mid(nr,n-s,1) n=n+1 if m=" " thensift=sift + " " elseif m=chr(62) then sift=sift + ">"else if m=chr(60) thensift=sift + "<" elseif m=chr(34) then sift=sift + """else if m=chr(38) thensift=sift + "&" elsesift=sift + m end ifend if end ifend if end if nextend function%><%i=1for x=1 to 5 select case i case 1 nr=CStr(request.form("Name")) s=len(nr) na=sift(nr,s) i=i+1 case 2 nr=CStr(request.form("mail")) if nr="" or nr="30字符内" then nr="empty" s=len(nr) if s>0 and nr<>"empty" then ma=sift(nr,s) else ma="empty" end if i=i+1 case 3 nr=CStr(request.form("Home")) if nr="" or nr="30字符内" then nr="empty" else if left(nr,7)<>"http://" then nr="http://" + nr end if s=len(nr) if s>0 and nr<>"empty" then ho=sift(nr,s) else ho="empty" end if i=i+1 case 4 nr=CStr(request.form("Caption")) s=len(nr) n=s+1 ca=sift(nr,s) i=i+1 case 5 nr=CStr(request.form("Text")) if len(nr)>300 then nr=left(nr,300) s=len(nr) n=s+1 te=sift(nr,s) i=i+1 end selectnext%>自己想了想,改用函数,成功了,嘿嘿
2007年06月05日 06点06分 2
1