Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string SqlChujection(string userInput)
- {
- string[] sqlCheckList = { "'",
- "--",
- ";--",
- ";",
- "/*",
- "*/",
- "@@",
- "@",
- "char",
- "nchar",
- "varchar",
- "nvarchar",
- "alter",
- "begin",
- "cast",
- "create",
- "cursor",
- "declare",
- "delete",
- "drop",
- "end",
- "exec",
- "execute",
- "fetch",
- "insert",
- "kill",
- "select",
- "sys",
- "sysobjects",
- "syscolumns",
- "table",
- "update"};
- for (int i = 0; i <= sqlCheckList.Length - 1; i++)
- {
- userInput = userInput.Replace(sqlCheckList[i].ToLower(), " ");
- userInput = userInput.Replace(sqlCheckList[i].ToUpper(), " ");
- }
- return userInput;
- }
Advertisement
Add Comment
Please, Sign In to add comment