/// <summary>
///SQL注入过滤
/// </summary>
/// <param name="InText">要过滤的字符串</param>
/// <returns>如果参数存在不安全字符,则返回true</returns>
public static bool SqlFilter(string InText)
{
string word = "and|20%and20%|insert|select|delete|update|chr|mid| master |20%master20%|or|truncate|char|declare|join";
//string word = "and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join";
if (InText == null)
return false;
foreach (string i in word.Split('|'))
{
if ((InText.ToLower().IndexOf(i + " ") > -1) || (InText.ToLower().IndexOf(" " + i) > -1))
{
return true;
}
}
return false;
}
sql注入过滤
最新推荐文章于 2024-04-30 04:08:20 发布