防止SQL注入完整ASP代码

maqi5856

maqi5856

2016-02-19 13:51

想要天天向上,就要懂得享受学习。图老师为大家推荐防止SQL注入完整ASP代码,精彩的内容需要你们用心的阅读。还在等什么快点来看看吧!

%
Dim Fy_Url,Fy_a,Fy_x,Fy_Cs(),Fy_Cl,Fy_Ts,Fy_Zx
'---定义部份  头------
Fy_Cl = 1  '处理方式:1=提示信息,2=转向页面,3=先提示再转向
Fy_Zx = "Error.Asp" '出错时转向的页面
'---定义部份  尾------

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/bianchengyuyan/)

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))),"and")0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"select")0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"update")0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"chr")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))),"insert")0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"mid")0 Or Instr(LCase(Request(Fy_Cs(Fy_x))),"master.")0 Then
  Select Case Fy_Cl
    Case "1"
  Response.Write "Script Language=JavaScriptalert('                   出现错误!参数 "&Fy_Cs(Fy_x)&" 的值中包含非法字符串!  请不要在参数中出现:;,and,select,update,insert,delete,chr 等非法字符!SQL通用防注入V1.0 ASP版 -- :;window.close();');window.close();/Script"
    Case "2"
  Response.Write "Script Language=JavaScriptlocation.href='"&Fy_Zx&"'/Script"
    Case "3"
  Response.Write "Script Language=JavaScriptalert('                   出现错误!参数 "&Fy_Cs(Fy_x)&"的值中包含非法字符串!  请不要在参数中出现:;,and,select,update,insert,delete,chr 等非法字符!SQL通用防注入V1.0 ASP版 -- ');location.href='"&Fy_Zx&"';');location.href='"&Fy_Zx&"';/Script"
  End Select
  Response.End
  End If
 End If
Next
%

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/bianchengyuyan/)
展开更多 50%)
分享

猜你喜欢

防止SQL注入完整ASP代码

编程语言 网络编程
防止SQL注入完整ASP代码

ASP上两个防止SQL注入式攻击Function

ASP
ASP上两个防止SQL注入式攻击Function

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

ASP SQL防注入的方法

Web开发
ASP SQL防注入的方法

SQL注入天书之ASP注入漏洞全接触

Web开发
SQL注入天书之ASP注入漏洞全接触

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

ASP防SQL注入攻击程序

ASP
ASP防SQL注入攻击程序

利用instr()函数防止SQL注入攻击

ASP
利用instr()函数防止SQL注入攻击

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

asp的ubb函数(推荐)

asp的ubb函数(推荐)

excel2010中添加删除工作表

excel2010中添加删除工作表
下拉加载更多内容 ↓