//效验    
    protected static boolean sqlValidate(String str) {    
        str = str.toLowerCase();//统一转为小写    
        String badStr = "'|select|update|and|or|delete|insert|truncate|char|into|iframe|href|script|activex|html|flash"  
                + "|substr|declare|exec|master|drop|execute|"  
                + "union|;|--|+|,|like|%|#|*|<|>|$|@|\"|http|cr|lf|<|>|(|)";//过滤掉的sql关键字,可以手动添加       
        String[] badStrs = badStr.split("\\|");    
        for (int i = 0; i < badStrs.length; i++) {    
            if (str.indexOf(badStrs[i]) >= 0) {    
                return true;    
            }    
        }    
        return false;    
    }    

 

相关文章:

  • 2021-04-06
  • 2022-12-23
  • 2021-11-07
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
猜你喜欢
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-07-26
  • 2022-12-23
相关资源
相似解决方案