最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
自己写一个防止SQL注入函数
时间:2022-06-30 10:12:08 编辑:袖梨 来源:一聚教程网
<%
function sqlcheck(Str,errtype)
if Instr(LCase(Str),"select ") > 0 or Instr(LCase(Str),"insert ") > 0 or Instr(LCase(Str),"delete ") > 0 or Instr(LCase(Str),"delete from ") > 0 or Instr(LCase(Str),"count(") > 0 or Instr(LCase(Str),"drop table") > 0 or Instr(LCase(Str),"update ") > 0 or Instr(LCase(Str),"truncate ") > 0 or Instr(LCase(Str),"asc(") > 0 or Instr(LCase(Str),"mid(") > 0 or Instr(LCase(Str),"char(") > 0 or Instr(LCase(Str),"xp_cmdshell") > 0 or Instr(LCase(Str),"exec master") > 0 or Instr(LCase(Str),"net localgroup administrators") > 0 or Instr(LCase(Str),"and ") > 0 or Instr(LCase(Str),"net user") > 0 or Instr(LCase(Str),"or ") > 0 then
Response.write("")
Response.End
end if
Str=Replace(Str,"_","") '过滤SQL注入_
Str=Replace(Str,"*","") '过滤SQL注入*
Str=Replace(Str," ","") '过滤SQL注入空格
Str=Replace(Str,chr(34),"") '过滤SQL注入"
Str=Replace(Str,chr(39),"") '过滤SQL注入'
Str=Replace(Str,chr(91),"") '过滤SQL注入[
Str=Replace(Str,chr(93),"") '过滤SQL注入]
Str=Replace(Str,chr(37),"") '过滤SQL注入%
Str=Replace(Str,chr(58),"") '过滤SQL注入:
Str=Replace(Str,chr(59),"") '过滤SQL注入;
Str=Replace(Str,chr(43),"") '过滤SQL注入+
Str=Replace(Str,"{","") '过滤SQL注入{
Str=Replace(Str,"}","") '过滤SQL注入}
sqlcheck=Str '返回经过上面字符替换后的Str
end function
%>
function sqlcheck(Str,errtype)
if Instr(LCase(Str),"select ") > 0 or Instr(LCase(Str),"insert ") > 0 or Instr(LCase(Str),"delete ") > 0 or Instr(LCase(Str),"delete from ") > 0 or Instr(LCase(Str),"count(") > 0 or Instr(LCase(Str),"drop table") > 0 or Instr(LCase(Str),"update ") > 0 or Instr(LCase(Str),"truncate ") > 0 or Instr(LCase(Str),"asc(") > 0 or Instr(LCase(Str),"mid(") > 0 or Instr(LCase(Str),"char(") > 0 or Instr(LCase(Str),"xp_cmdshell") > 0 or Instr(LCase(Str),"exec master") > 0 or Instr(LCase(Str),"net localgroup administrators") > 0 or Instr(LCase(Str),"and ") > 0 or Instr(LCase(Str),"net user") > 0 or Instr(LCase(Str),"or ") > 0 then
Response.write("")
Response.End
end if
Str=Replace(Str,"_","") '过滤SQL注入_
Str=Replace(Str,"*","") '过滤SQL注入*
Str=Replace(Str," ","") '过滤SQL注入空格
Str=Replace(Str,chr(34),"") '过滤SQL注入"
Str=Replace(Str,chr(39),"") '过滤SQL注入'
Str=Replace(Str,chr(91),"") '过滤SQL注入[
Str=Replace(Str,chr(93),"") '过滤SQL注入]
Str=Replace(Str,chr(37),"") '过滤SQL注入%
Str=Replace(Str,chr(58),"") '过滤SQL注入:
Str=Replace(Str,chr(59),"") '过滤SQL注入;
Str=Replace(Str,chr(43),"") '过滤SQL注入+
Str=Replace(Str,"{","") '过滤SQL注入{
Str=Replace(Str,"}","") '过滤SQL注入}
sqlcheck=Str '返回经过上面字符替换后的Str
end function
%>
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22