专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Asp教程 » asp防注入代码:防止ASP注入代码 »正文

asp防注入代码:防止ASP注入代码

来源: 发布时间:星期四, 2008年9月25日 浏览:405次 评论:0
\'检查Url的合法性
Dim Fy_Url,Fy_a,Fy_x,Fy_Cs(),Fy_Cl,Fy_Ts,Fy_Zx
Fy_Cl = 3\'处理方式:1=提示信息,2=转向页面,3=先提示再转向
Fy_Zx = \"index.Asp\"\'出错时转向的页面
On Error Resume Next
Fy_Url=Request.ServerVariables(\"QUERY_STRING\")
Fy_a=split(Fy_Url,\"&\")
redim Fy_Cs(ubound(Fy_a))
On Error Resume Next
for Fy_x=0 to ubound(Fy_a)
Fy_Cs(Fy_x) = left(Fy_a(Fy_x),instr(Fy_a(Fy_x),\"=\")-1)
Next
For Fy_x=0 to ubound(Fy_Cs)
If Fy_Cs(Fy_x)<>\"\" Then
If Instr(LCase(Request(Fy_Cs(Fy_x))),\"\'\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\"%20and%20\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\"%20select%20\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\"%20update%20\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\"%20chr\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\"delete%20from\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\";\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\"%20insert%20\")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),\"%20mid\")<>0 Or Instr(LCase(Request(Fy_Cs(Fy_x))),\"master.\")<>0 Then
Select Case Fy_Cl
Case \"1\"
Response.Write \"<Script Language=JavaScript>alert(\' 出现错误!参数 \"&Fy_Cs(Fy_x)&\" 的值中包含非法字符串!\\n\\n 请不要在参数中出现:;,and,select,update,insert,delete,chr 等非法字符!\');window.close();</Script>\"
Case \"2\"
Response.Write \"<Script Language=JavaScript>location.href=\'\"&Fy_Zx&\"\'</Script>\"
Case \"3\"
Response.Write \"<Script Language=JavaScript>alert(\' 出现错误!参数 \"&Fy_Cs(Fy_x)&\"的值中包含非法字符串!\\n\\n 请不要在参数中出现:;,and,select,update,insert,delete,chr 等非法字符!\');location.href=\'\"&Fy_Zx&\"\';</Script>\"
End Select
Response.End
End If
End If
Next

相关文章

读者评论

  • 1suone(58.83.228.*) 发布于:星期四, 2008年12月11日22:43
    这里怎么没有讲到怎么用呢,
  • 1 共1条 分1页

发表评论

  • 昵称:
  • 内容: