zoukankan      html  css  js  c++  java
  • SQL过滤敏感字符

    /// <summary>
            /// SQL过滤敏感字符
            /// </summary>
            /// <param name="InText">要特殊过滤的字符串</param>
            /// <returns>过滤后的字符串</returns>
            public static string SqlFilterSpecial(string InText)
            {
                if (InText == "") //如果字符串为空,直接返回。
                {
                    return InText;
                }
                else
                {
                    InText = InText.Replace("and ", "");
                    InText = InText.Replace("exec ", "");
                    InText = InText.Replace("insert ", "");
                    InText = InText.Replace("select ", "");
                    InText = InText.Replace("delete ", "");
                    InText = InText.Replace("update ", "");
                    InText = InText.Replace(" and", "");
                    InText = InText.Replace(" exec", "");
                    InText = InText.Replace(" insert", "");
                    InText = InText.Replace(" select", "");
                    InText = InText.Replace(" delete", "");
                    InText = InText.Replace(" update ", "");
                    InText = InText.Replace("chr ", "");
                    InText = InText.Replace("mid ", "");
                    InText = InText.Replace(" chr", "");
                    InText = InText.Replace(" mid", "");
                    InText = InText.Replace("master ", "");
                    InText = InText.Replace(" master", "");
                    InText = InText.Replace("or ", "");
                    InText = InText.Replace(" or", "");
                    InText = InText.Replace("truncate ", "");
                    InText = InText.Replace("char ", "");
                    InText = InText.Replace("declare ", "");
                    InText = InText.Replace("join ", "");
                    InText = InText.Replace("union ", "");
                    InText = InText.Replace("truncate ", "");
                    InText = InText.Replace(" char", "");
                    InText = InText.Replace(" declare", "");
                    InText = InText.Replace(" join", "");
                    InText = InText.Replace(" union", "");
                    InText = InText.Replace("'", "");
                    InText = InText.Replace("<", "");
                    InText = InText.Replace(">", "");
                    InText = InText.Replace("%", "");
                    InText = InText.Replace("'delete", "");
                    InText = InText.Replace("''", "");
                    InText = InText.Replace("\"\"", "");
                    InText = InText.Replace(",", "");
                    InText = InText.Replace(">=", "");
                    InText = InText.Replace("=<", "");
                    InText = InText.Replace("--", "");
                    InText = InText.Replace("_", "");
                    InText = InText.Replace(";", "");
                    InText = InText.Replace("||", "");
                    InText = InText.Replace("[", "");
                    InText = InText.Replace("]", "");
                    InText = InText.Replace("&", "");
                    InText = InText.Replace("/", "");
                    InText = InText.Replace("?", "");
                    InText = InText.Replace(">?", "");
                    InText = InText.Replace("?<", "");
                    InText = InText.Replace(" ", "");
                    return InText;
                }
            }
  • 相关阅读:
    C#中实现简单的预警提示功能(语音提示与弹窗提示)
    C#中使用SoundPlayer播放音频文件(wav文件)
    Angular中路由的嵌套-父子路由
    Winform中设置ZedGraph的坐标轴的标题和刻度不显示十次幂
    Angular中使用JS实现路由跳转、动态路由传值、get方式传值
    surprise库官方文档分析(二):使用预测算法
    surprise库官方文档分析(一)
    webpack官方文档分析(三):Entry Points详解
    webpack官方文档分析(二):概念
    webpack官方文档分析(一):安装
  • 原文地址:https://www.cnblogs.com/MySpace/p/1599871.html
Copyright © 2011-2022 走看看