快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

银河娱乐app手机下载:ASP安全检测与过滤函数SafeCheck



'感化:安然字符串检测函数

'名字:SafeCheck

'参数:CheckString,CheckType,CheckLength

'阐明:

'Checkstring待检测字符串:随意率性字符.

'CheckType检测类型0正常短字符1数字2日期3金钱4编码HTML5解码HTML6登录字符串7防进击检测

'CheckLength检测类型长度:类型为int,当为金钱时为小数点的位置

'返回值:假如经由过程检测,返回精确字符串,

'假如未经由过程则返回差错代码SYSTEM_ERROR|ERROR_CODE

'script Writen by :SnowDu(杜雪.NET)

'Web:http://www.snsites.com/

'Web:http://www.domai银河娱乐app手机下载n.com/

'-------------------------------------------

function SafeCheck(CheckString,CheckType,CheckLength)

On Error Resume Next

ErrorRoot="SYSTEM_ERROR|"

if checkString="" then

SafeCheck=ErrorRoot&"00001"

exit function

end if

CheckString=WordStr(CheckString,"'","'")

select case CheckType

case 0

CheckString=trim(CheckString)

SafeCheck=Left(CheckString,CheckLength银河娱乐app手机下载)

case 1

if not isnumberic(CheckString) then

SafeCheck=ErrorRoot&"00002"

exit function

else

SafeCheck=Left(CheckString,CheckLength)

end if

case 2

tempVar=IsDate(CheckString)

if Not TempVar then

SafeCheck=ErrorRoot&"00003"

exit function

else

select case CheckLength

case 0

SafeCheck=FormatDateTime(CheckString,vbShortDate)

case 1

SafeCheck=FormatDateTime(CheckString,vbLongDate)

case 2

SafeCheck=CheckString

end select

end if

case 3

tempVar=FormatCurrency(CheckString,0)

if Err then

SafeCheck=ErrorRoot&"00004"

exit function

else

SafeCheck=FormatCurrency(CheckString,CheckLength)

end if

case 4

sTemp = CheckString

If IsNull(sTemp) = True Then

SafeCheck=ErrorRoot&"00005"

Exit Function

End If

sTemp = WordStr(sTemp, "&", "&")

sTemp = WordStr(sTemp, "", ">")

sTemp = WordStr(sTemp, Chr(34), """)

sTemp = WordStr(sTemp, Chr(10), "

")

SafeCheck = Left(sTemp,CheckLength)

case 5

sTemp = CheckString

If IsNull(sTemp) = True Then

SafeCheck=ErrorRoot&"00006"

Exit Function

End If

sTemp = WordStr(sTemp, "&", "&")

sTemp = WordStr(sTemp, "", ">")

sTemp = WordStr(sTemp, """, Chr(34))

sTemp = WordStr(sTemp, "

",Chr(10))

SafeCheck = Left(sTemp,CheckLength)

case 6

s_BadStr = "'  & 0 Then

IsSafeStr = False

End If

Next

if IsSafeStr then

SafeCheck=left(CheckString,CheckLength)

else

SafeCheck=ErrorRoot&"00007"

Exit Function

end if

case 7

s_Filter="net user|xp_cmdshell|/add|select|count|asc|char|mid|'|""|"银河娱乐app手机下载

S_Filter=S_Filter&"in银河娱乐app手机下载sert|delete|drop|truncate|from|%|declare|-"

S_Filters=split(S_Filter,"|")

isFo银河娱乐app手机下载und=false

for i=0 to ubound(S_Filters)-1

if Instr(lcase(CheckString),lcase(S_Filters(i)))

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: