zoukankan      html  css  js  c++  java
  • sql过滤检验

        /// <summary>
        /// 过滤SQL注入
        /// </summary>
        /// <param name="strSQL"></param>
        /// <returns></returns>
        public static bool CheckSQLInjection(string strSQL)
        {
            if (string.IsNullOrEmpty(strSQL))
            {
                return true;
            }
            else
            {
                Regex RegExpression = new Regex(@"\s");
                strSQL = RegExpression.Replace(strSQL.Trim().Trim().ToLower().Replace("%20", " "), " ");
                string Pattern = @"select |insert |delete from |count\(|drop table|update |truncate |asc\(|mid\(|char\(|xp_cmdshell|exec master|net localgroup administrators|:|net user|""|\'| or ";

                if (Regex.IsMatch(strSQL, Pattern))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }

  • 相关阅读:
    struts2文件上传大小限制问题
    kindeditor使用方法
    ajaxFileUpload SyntaxError: syntax error
    Attempted to lock an already-locked dir异常解决方法
    Simditor图片上传
    心理学
    Vue.JS
    SQL Server 日常维护经典应用
    12 个 JS 技巧
    Linq to js
  • 原文地址:https://www.cnblogs.com/zijinguang/p/1237566.html
Copyright © 2011-2022 走看看