posts - 58,  comments - 8,  trackbacks - 0
Function SafeRequest(ParaName)
Dim ParaValue
ParaValue=Request(ParaName)
if IsNumeric(ParaValue) = True then
SafeRequest=ParaValue
exit Function
elseIf Instr(LCase(ParaValue),"select ") > 0 or Instr(LCase(ParaValue),"insert ") > 0 or Instr(LCase(ParaValue),"delete from") > 0 or Instr(LCase(ParaValue),"count(") > 0 or Instr(LCase(ParaValue),"drop table") > 0 or Instr(LCase(ParaValue),"update ") > 0 or Instr(LCase(ParaValue),"truncate ") > 0 or Instr(LCase(ParaValue),"asc(") > 0 or Instr(LCase(ParaValue),"mid(") > 0 or Instr(LCase(ParaValue),"char(") > 0 or Instr(LCase(ParaValue),"xp_cmdshell") > 0 or Instr(LCase(ParaValue),"exec master") > 0 or Instr(LCase(ParaValue),"net localgroup administrators") > 0  or Instr(LCase(ParaValue)," and ") > 0 or Instr(LCase(ParaValue),"net user") > 0 or Instr(LCase(ParaValue)," or ") > 0 then
 Response.Write "<script language='javascript'>"
 Response.Write "alert('非法的请求!');"  '发现SQL注入攻击提示信息
 Response.Write "location.href='http://www.wz114.com/';"  '发现SQL注入攻击转跳网址
 Response.Write "<script>"
 Response.end
else
SafeRequest=ParaValue
End If
End function

使用SafeRequest函数替换你的Request

可以防范所有的SQL注入攻击
posted on 2007-02-11 16:29 forrest 阅读(234) 评论(0)  编辑 收藏 引用 所属分类: 编程语言
只有注册用户登录后才能发表评论。
<2007年9月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿(5)

随笔分类(59)

随笔档案(58)

文章分类(41)

文章档案(52)

相册

收藏夹

postfix

windows 系统

编程

  • how to be a programmer
  • 写给想当程序员的朋友
  • 谨以此文献给所有想当程序员的朋友 (一) 文章由来及个人经历 我是一名计算机专业的本科毕业生,毕业已经1年多了。毕业后从事的是软件编程工作,经常有其他专业的朋友想从事软件编程工作,向我请教如何,因为我自觉涉行不深,不敢信口开河,无奈朋友信任,我不得不郑重考虑一下这个问题了,来帮助朋友选择和回报朋友的信任。

搜索

  •  

最新评论

阅读排行榜

评论排行榜