最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
sql 安全过滤函数 asp sql 防注入函数
时间:2022-06-30 09:13:56 编辑:袖梨 来源:一聚教程网
Public Function SafeSql(str)
Dim tempStr
tempStr = Trim(LCase(str))
If tempStr = "" Or IsNull(tempStr) Or IsEmpty(tempStr) Then
SafeSql = ""
Exit Function
End If
tempStr = Replace(tempStr,Chr(0),"")
tempStr = Replace(tempStr,Chr(13),"
")
tempStr = Replace(tempStr,"""",""")
tempStr = Replace(tempStr,"<","<")
tempStr = Replace(tempStr,">",">")
tempStr = Replace(tempStr,"*","*")
tempStr = Replace(tempStr,"%","%")
tempStr = Replace(tempStr,"'","'")
tempStr = Replace(tempStr,"script","Script")
tempStr = Replace(tempStr,"object","Object")
tempStr = Replace(tempStr,"applet","Applet")
tempStr = Replace(tempStr,"select","select")
tempStr = Replace(tempStr,"execute","execute")
tempStr = Replace(tempStr,"exec","exec")
tempStr = Replace(tempStr,"join","join")
tempStr = Replace(tempStr,"union","union")
tempStr = Replace(tempStr,"where","where")
tempStr = Replace(tempStr,"insert","insert")
tempStr = Replace(tempStr,"delete","delete")
tempStr = Replace(tempStr,"update","update")
tempStr = Replace(tempStr,"like","like")
tempStr = Replace(tempStr,"drop","drop")
tempStr = Replace(tempStr,"create","create")
tempStr = Replace(tempStr,"rename","rename")
tempStr = Replace(tempStr,"count","count")
tempStr = Replace(tempStr,"chr","chr")
tempStr = Replace(tempStr,"mid","mid")
tempStr = Replace(tempStr,"truncate","truncate")
tempStr = Replace(tempStr,"nchar","nchar")
tempStr = Replace(tempStr,"char","char")
tempStr = Replace(tempStr,"alter","alter")
tempStr = Replace(tempStr,"cast","cast")
tempStr = Replace(tempStr,"exists","exists")
If tempStr = LCase(str) Then
SafeSql = str
Else
SafeSql = tempStr
End If
End Function
Public Function SelectSql(sqlStr)
If sqlStr = "" Or IsNull(sqlStr) Or IsEmpty(sqlStr) Then
SelectSql = True
Exit Function
End If
Dim errSqlStr,errSqlSplit,i,j
sqlStr = LCase(sqlStr)
errSqlStr = "insert,update,delete,create,drop,alter,rename"
errSqlSplit = Split(errSqlStr,",")
j = 0
For i = 0 To UBound(errSqlSplit)
If InStr(sqlStr,errSqlSplit(i)) <> 0 Then j = j + 1
Next
If j = 0 Then
SelectSql = True
Else
SelectSql = False
End If
End Function
相关文章
- 炉石传说网易云音乐联动怎么玩 网易云音乐联动活动介绍 11-22
- 《潜行者2:切尔诺贝利之心》游戏车辆使用推荐 11-22
- 《潜行者2:切尔诺贝利之心》挡路的特异点处理方法介绍 11-22
- 《潜行者2:切尔诺贝利之心》开局获得满强AK方法介绍 11-22
- 《潜行者2:切尔诺贝利之心》军用防弹背心获得方法介绍 11-22
- 《潜行者2:切尔诺贝利之心》防毒面具获得方法介绍 11-22