1.编写验证字符串的代码:
public static boolean isIllegal(String str){
if(str == null){
str = "";
}
if(str.indexOf(">") != -1 || str.indexOf("<") != -1
|| str.indexOf("and") != -1
|| str.indexOf("or") != -1 || str.indexOf("OR") != -1
|| str.indexOf("exec") != -1 || str.indexOf("EXEC") != -1
|| str.indexOf("insert") != -1 || str.indexOf("INSERT") != -1
|| str.indexOf("select") != -1 || str.indexOf("SELECT") != -1
|| str.indexOf("union") != -1 || str.indexOf("UNION") != -1
|| str.indexOf("update") != -1 || str.indexOf("UPDATE") != -1
|| str.indexOf("count") != -1 || str.indexOf("count") != -1
){
return true;
}
return false;
}
转载请注明原文地址: https://ju.6miu.com/read-1294947.html