asp防止sql 语句注入的代码
来源:互联网 发布:雷军投资知乎 编辑:程序博客网 时间:2024/05/01 08:02
Function Safe(str)'该函数用来判断传递过来的变量是否包含特殊字符,没有返回TRUE
Dim s_BadStr, n, i
s_BadStr = "'&<>?%,;:()`~!@#$^*{}[]|//+-="&chr(34)&chr(32)
n = Len(s_BadStr)
Safe = True
For i = 1 To n
If Instr(str, Mid(s_BadStr, i, 1)) > 0 Then
Safe = False
Exit Function
End If
Next
End Function
''''''''''''''''''''''''''''''''''''以下代码直接判断发生请求的URL是否包含非法字符
On Error Resume Next
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
strTemp = strTemp & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then strTemp = strTemp & "?" & Trim(Request.QueryString)
strTemp = LCase(strTemp)
If Instr(strTemp,"select%20") or Instr(strTemp,"insert%20") or Instr(strTemp,"delete%20from") or Instr(strTemp,"count(") or Instr(strTemp,"drop%20table") or Instr(strTemp,"update%20") or Instr(strTemp,"truncate%20") or Instr(strTemp,"asc(") or Instr(strTemp,"mid(") or Instr(strTemp,"char(") or Instr(strTemp,"xp_cmdshell") or Instr(strTemp,"exec%20master") or Instr(strTemp,"net%20localgroup%20administrators") or Instr(strTemp,"db_name(") or Instr(strTemp,"net%20user") or Instr(strTemp,"'") or Instr(strTemp,"%20or") or Instr(strTemp,"backup%20") then
Response.Write "<script language='javascript'>"
Response.Write "alert('非法地址!!');"
Response.Write "javascript:history.go(-1)"
Response.Write "</script>"
End If
For Each name In Request.Form
Dim s_BadStr, s_Sz, i
s_BadStr = "'|and|select|update|chr|delete|from|;|insert|mid|master.|truncate|db_name|xp_cmdshell|exec%20master|net%20localgroup%20administrators|drop|table|db_name(|exec"
s_Sz = split(s_BadStr,"|")
For i = 0 To ubound(s_Sz)
If Instr(Request.Form(name), s_Sz(i)) > 0 Then
Response.Write "<script language='javascript'>"
Response.Write "alert('非法地址!!');"
Response.Write "javascript:history.go(-1);"
Response.Write "</script>"
End If
Next
next
- asp防止sql 语句注入的代码
- 防止SQL注入完整ASP代码
- C#,Asp.net 防止Sql 注入代码
- asp 防止SQL注入代码运行
- asp 防止SQL注入
- ASP防止注入代码:
- 如何防止Sql语句的注入?
- php 防止sql 注入的语句
- ASP.NET 防止SQL注入的函数
- ASP防止SQL注入的问题
- ASP.NET防止Sql注入的解决方法
- ASP防止SQL注入的360解决方案
- ASP.NET防止Sql注入的解决方法
- 防止SQL注入-参数化SQL例代码asp.net
- 通用的防止SQL注入代码
- PHP防止SQL注入的实现代码
- jsp防止sql语句注入
- php 防止sql语句注入
- □ 影片名:《杀破狼-新片》(21652) 在线播放
- 程序员成长最快的环境
- Linux系统中搭建LAMP动态博客网站
- □ 影片名:《拳霸2冬阴功》(20240) 在线播放
- 数据库笔记
- asp防止sql 语句注入的代码
- SqlRootkit - by jnc
- □ 影片名:《哥斯拉》(4877) 在线播放
- □ 影片名:《美国掌握拉登的情报》(7712) 在线播放
- 新百家姓出来了,看你排第几位?
- □ 影片名:《举起手来》(45844) 在线播放
- 打印机好贵
- 重装系统后要做十件大事
- □ 影片名:《大内密探零零发》(1188) 在线播放