检查页面是否包含特定语句

来源:百度知道 编辑:UC知道 时间:2024/05/29 11:49:32
如何检查页面是否包含特定语句,如果没有则禁止提交输入数据.
要写怎样的代码,或者要通过什么样的途径做到..

<%
'Dim Fy_Post,Fy_Get,Fy_In,Fy_Inf,Fy_Xh,Fy_db,Fy_dbstr
'自定义需要过滤的字串,用 "|" 分隔
Fy_In = "'|;|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
'----------------------------------
%>

<%
Fy_Inf = split(Fy_In,"|")

If Request.Form<>"" Then
For Each Fy_Post In Request.Form

For Fy_Xh=0 To Ubound(Fy_Inf)
If Instr(LCase(Request.Form(Fy_Post)),Fy_Inf(Fy_Xh))<>0 Then
Response.Write "操作页面:"&Request.ServerVariables("URL")&"<br>"
Response.Write "提交方式:POST<br>"
Response.Write "提交参数:"&Fy_Post&"<br>"
Response.Write "提交数据:"&Request.Form(Fy_Post)
Response.End
End If
Next

Next
End If

%>

插入验证吗!写一个验证函数,在插入数据库的时候调用!