C# 過(guò)濾SQL注入
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
///<summary>
///SQL注入過(guò)濾 ///</summary> ///<param name="InText">要過(guò)濾的字符串</param> ///<returns>如果參數(shù)存在不安全字符,則返回true</returns> publicboolSqlFilter(stringInText) { stringword="and|exec|insert|select|delete|update|chr|mid|master|or|truncate|char|declare|join|cmd"; if(InText==null) returnfalse; foreach(stringiinword.Split(''|'')) { if((InText.ToLower().IndexOf(i+"")>-1)||(InText.ToLower().IndexOf(""+i)>-1)) { returntrue; } } returnfalse; } 該文章在 2021/1/29 9:40:58 編輯過(guò) |
關(guān)鍵字查詢(xún)
相關(guān)文章
正在查詢(xún)... |