比如 在登陆的时候 可以用 '1 or那些的过滤!
什么意思?有点看不懂!
<%
''过滤提交表单中的SQL
''==========================
function ForSqlForm(form_title)
dim fqys,errc,i,items
dim nothis(18)
nothis(0)="net user"
nothis(1)="xp_cmdshell"
nothis(2)="/add"
nothis(3)="exec%20master.dbo.xp_cmdshell"
nothis(4)="net localgroup administrators"
nothis(5)="select"
nothis(6)="count"
nothis(7)="asc"
nothis(8)="char"
nothis(9)="mid"
nothis(10)="''"
nothis(11)="iframe"
nothis(12)=""""
nothis(13)="insert"
nothis(14)="delete"
nothis(15)="drop"
nothis(16)="truncate"
nothis(17)="from"
nothis(18)="%"
''nothis(19)="@"
errc=false
for i= 0 to ubound(nothis)
for each items in request.Form
if instr(form_title,nothis(i))<>0 then
response.write("<div class='menu'>")
response.write("你所填写的信息:" & server.HTMLEncode(request.Form(items)) & "<br>含非法字符:" & nothis(i))
response.write("</div>")
response.write("对不起,你所填写的信息含非法字符!<a href=""#"" onclick=""history.back()"">返回</a>")
response.End()
end if
next
next
end function
''==========================
%>
不知道这是不是你想要的!
三楼的,但简单的还有
[CODE]<%
'自定义需要过滤的字串,用 "|" 分隔
WebFy_In = "'|;|and|(|)|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
'----------------------------------
%>
<%
WebFy_Inf = split(WebFy_In,"|")
'--------POST部份------------------
If Request.Form<>"" Then
For Each WebFy_Post In Request.Form
For WebFy_Xh=0 To Ubound(WebFy_Inf)
If Instr(LCase(Request.Form(WebFy_Post)),WebFy_Inf(WebFy_Xh))<>0 Then
Response.Write "<Script Language=JavaScript>alert('系统提示↓\n\n请不要在参数中包含非法字符尝试注入!');window.close();</Script>"
Response.End
End If
Next
Next
End If
%>[/CODE]
我给你一个,附带管理系统的。
我买的一本教程里面光盘的内容,仅供学习哦~~~
[此贴子已经被作者于2007-6-16 0:19:01编辑过]