最新下载
热门教程
- 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
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20