最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp sql安全过滤及防注入程序代码
时间:2022-06-30 09:14:08 编辑:袖梨 来源:一聚教程网
'**************************************************
'函数名:ReplaceBadChar
'作 用:过滤非法的SQL字符
'参 数:strChar-----要过滤的字符
'返回值:过滤后的字符
'**************************************************
function ReplaceBadChar(strChar)
if strChar="" then
ReplaceBadChar=""
else
ReplaceBadChar=replace(replace(replace(replace(replace(replace(replace(replace(strChar,"'",""),"*",""),"?",""),"(",""),")",""),"<",""),".",""),"%","")
end if
end function
'**************************************************
'函数名:CheckBadChar
'作 用:检查非法字符
'参 数:strChar-----要检查的字符
'返回值:检查后的字符 有非法的为True
'作 者: designed by jeanun
'**************************************************
function CheckBadChar(strChar)
if Instr(strChar,"=")>0 or Instr(strChar,"%")>0 or Instr(strChar,"?")>0 or Instr(strChar,"&")>0 or Instr(strChar,";")>0 or Instr(strChar,",")>0 or Instr(strChar,"'")>0 or Instr(strChar,",")>0 or Instr(strChar,chr(34))>0 or Instr(strChar,chr(9))>0 or Instr(strChar,"$")>0 then
CheckBadChar = true
else
CheckBadChar = false
end if
end function
'**************************************************
'函数名:SafeRequest
'作 用:安全的Request,只能取得[数字]
'参 数:strChar-----字段名称
'返回值:检查后的读取字符
'作 者: designed by jeanun
'**************************************************
function SafeRequest(strChar)
strChar = Trim(Request(""& strChar &""))
if CheckBadChar(strChar) = True Or IsNumeric(strChar) = False then
Response.Write("")
Response.End()
else
SafeRequest = strChar
end if
end function
相关文章
- 实用伴唱app下载推荐 热门伴唱软件排行榜 07-30
- 免费视频提取软件合集 值得推荐的视频提取软件盘点 07-30
- 有哪些软件英语推荐 值得推荐的英语app盘点 07-30
- 日结临时工app哪个平台靠谱 真实可靠的日结临时工app推荐 07-30
- ai做ppt一键生成工具推荐 ai做ppt一键生成工具有哪些 07-30
- 学泰语的app哪个更好 学泰语的app实用分享 07-30