主頁 > 知識庫 > asp 實現(xiàn)對SQL注入危險字符進行重編碼處理的函數(shù)

asp 實現(xiàn)對SQL注入危險字符進行重編碼處理的函數(shù)

熱門標簽:宜賓語音外呼系統(tǒng)軟件 中國辦理電信400電話 伊春外呼業(yè)務(wù)系統(tǒng) 電銷機器人源碼網(wǎng)盤下載 福建外呼增值業(yè)務(wù)線路 綿陽防封電銷卡價格 調(diào)度系統(tǒng)外呼 河北智能外呼系統(tǒng)軟件 電銷機器人教育
%
'******************************
'函數(shù):CheckStr(byVal ChkStr)
'參數(shù):ChkStr,待驗證的字符
'作者:阿里西西
'日期:2007/7/15
'描述:對SQL注入危險字符進行重編碼處理
'示例:CheckStr("and 1=1 or select * from")
'******************************
Function CheckStr(byVal ChkStr)
 Dim Str:Str=ChkStr
 Str=Trim(Str)
 If IsNull(Str) Then
  CheckStr = ""
  Exit Function 
 End If
 Dim re
 Set re=new RegExp
 re.IgnoreCase =True
 re.Global=True
 re.Pattern="(\r\n){3,}"
 Str=re.Replace(Str,"$1$1$1")
 Set re=Nothing
 Str = Replace(Str,"'","''")
 Str = Replace(Str, "select", "sel#101;ct")
 Str = Replace(Str, "join", "jo#105;n")
 Str = Replace(Str, "union", "un#105;on")
 Str = Replace(Str, "where", "wh#101;re")
 Str = Replace(Str, "insert", "ins#101;rt")
 Str = Replace(Str, "delete", "del#101;te")
 Str = Replace(Str, "update", "up#100;ate")
 Str = Replace(Str, "like", "lik#101;")
 Str = Replace(Str, "drop", "dro#112;")
 Str = Replace(Str, "create", "cr#101;ate")
 Str = Replace(Str, "modify", "mod#105;fy")
 Str = Replace(Str, "rename", "ren#097;me")
 Str = Replace(Str, "alter", "alt#101;r")
 Str = Replace(Str, "cast", "ca#115;t")
 CheckStr=Str
End Function

'反編上面函數(shù)處理過的字符串

Function UnCheckStr(Str)
  Str = Replace(Str, "sel#101;ct", "select")
  Str = Replace(Str, "jo#105;n", "join")
  Str = Replace(Str, "un#105;on", "union")
  Str = Replace(Str, "wh#101;re", "where")
  Str = Replace(Str, "ins#101;rt", "insert")
  Str = Replace(Str, "del#101;te", "delete")
  Str = Replace(Str, "up#100;ate", "update")
  Str = Replace(Str, "lik#101;", "like")
  Str = Replace(Str, "dro#112;", "drop")
  Str = Replace(Str, "cr#101;ate", "create")
  Str = Replace(Str, "mod#105;fy", "modify")
  Str = Replace(Str, "ren#097;me", "rename")
  Str = Replace(Str, "alt#101;r", "alter")
  Str = Replace(Str, "ca#115;t", "cast")
  UnCheckStr=Str
End Function
%>

標簽:優(yōu)質(zhì)小號 那曲 河池 銅川 新鄉(xiāng) 蘇州 延邊 電商邀評

巨人網(wǎng)絡(luò)通訊聲明:本文標題《asp 實現(xiàn)對SQL注入危險字符進行重編碼處理的函數(shù)》,本文關(guān)鍵詞  asp,實現(xiàn),對,SQL,注入,危險,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp 實現(xiàn)對SQL注入危險字符進行重編碼處理的函數(shù)》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp 實現(xiàn)對SQL注入危險字符進行重編碼處理的函數(shù)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章