  | 
              热门文章 | 
             
            | 
         
        
           | 
         
       
	  
	  
     | 
	 | 
    
	
      
        | ASP通用防注入代码 | 
       
      
        来源:百度空间 更新时间:2011/11/28 17:21:46 阅读次数: 
字体:[大 中 小大 中 小大 中 小] 我要投稿 | 
       
      
        
 <% '''''''''''''''''''''''' 'ASP通用防注入代码  '您可以把该代码COPY到头文件中.也可以单独作 '为一个文件存在,每次调用使用  '作者:y3gu - 2005-7-29  ''''''''''''''''''''''''''''''''' Dim GetFlag Rem(提交方式) Dim ErrorSql Rem(非法字符)  Dim RequestKey Rem(提交数据) Dim ForI Rem(循环标记) ErrorSql = "'~;~and~(~)~exec~update~count~*~%~chr~ mid~master~truncate~char~declare" Rem(每个敏感字符或者词语请使用半角 "~" 格开) ErrorSql = split(ErrorSql,"~") If Request.ServerVariables("REQUEST_METHOD")="GET" Then GetFlag=True Else GetFlag=False End If If GetFlag Then For Each RequestKey In Request.QueryString For ForI=0 To Ubound(ErrorSql) If Instr(LCase(Request.QueryString(RequestKey)),ErrorSql(ForI))<>0 Then response.write "<script>alert(""警告:\n请不要使用敏感字符"");location.href=""Sql.asp"";</script>" Response.End End If Next Next  Else For Each RequestKey In Request.Form For ForI=0 To Ubound(ErrorSql) If Instr(LCase(Request.Form(RequestKey)),ErrorSql(ForI))<>0 Then response.write "<script>alert(""警告:\n请不要使用敏感字符"");location.href=""Sql.asp"";</script>" Response.End End If Next Next End If %> | 
       
      
        | 上一篇文章: ASP缓存模块下一篇文章: 用asp制作多关键字搜索 | 
       
	  
        | 
 | 
       
     
	 |