ASP通用防注

开发者在线 Builder.com.cn 更新时间:2007-12-21作者:Purple 来源:CSDN

本文关键词: 防注 通用 ASP

一般加到CONN.ASP数据库连接里就可以了。
<%
Dim MQ_NoSqlHack_AllStr,MQ_NoSqlHack_Str,MQ_NoSqlHack_ComeUrlGet,MQ_NoSqlHack_ComeUrlPost,MQ_NoSqlHack_Get,MQ_NoSqlHack_Post,MQ_NoSqlHack_i
'On Error Resume Next
MQ_NoSqlHack_AllStr="'|;| and |chr(|exec |insert |select |delete from|update |mid(|master."
MQ_NoSqlHack_ComeUrlGet   = Request.QueryString
MQ_NoSqlHack_ComeUrlPost  = Request.Form
MQ_NoSqlHack_Str = Split(MQ_NoSqlHack_AllStr,"|")
'Post
If MQ_NoSqlHack_ComeUrlPost<>"" then
 For Each MQ_NoSqlHack_Post In Request.Form
  For MQ_NoSqlHack_i = 0 To Ubound(MQ_NoSqlHack_Str)
   If Instr(LCase(Request.Form(MQ_NoSqlHack_Post)),MQ_NoSqlHack_Str(MQ_NoSqlHack_i))<>0 Then
    Response.Write("<script>alert('不要这样嘛!');javascript:history.go(-1);</script>")
    Response.End
   End if
  Next
 Next
End if
'Get
If MQ_NoSqlHack_ComeUrlGet<>"" then
 For Each MQ_NoSqlHack_Get In Request.QueryString
  For MQ_NoSqlHack_i = 0 To Ubound(MQ_NoSqlHack_Str)
   If Instr(LCase(Request.QueryString(MQ_NoSqlHack_Get)),MQ_NoSqlHack_Str(MQ_NoSqlHack_i))<>0 Then
    Response.Write("<script>alert('不要这样嘛!');javascript:history.go(-1);</script>")
    Response.End
   End if
  Next
 Next
End if
%> 

 

查看本文来源

用户评论

  • 用户名
  • 评论内容