函数很简单, 主要是针对字符串和数字两种类型的传入数据分别进行了处理,具体用法: |%3O)B
MyM+C}
字符类型的 7n<#y;wo
strUsername = CheckInput(Request(“username“),“s“) 8 +L7E-
数字类型的 E.4n}s
ID = CheckInput(Request(“id“),“i“) <q1'Li)_R
k{qLkcOg=
下面是函数 \ j
x0ZHR
I<9n(rA
){jqfkL
Function CheckInput(str,strType) J(&Gmk9&
函数功能:过滤字符参数中的单引号,对于数字参数进行判断,如果不是数值类型,则赋值0 S]. Ft/+H
参数意义: str ---- 要过滤的参数 !}j,TPpG
strType ---- 参数类型,分为字符型和数字型,字符型为s,数字型为i WkcH5[
Dim strTmp zdT ->%
strTmp = Y"s
)u7
If strType =s Then u[:
P
strTmp = Replace(Trim(str),,) lxCX-a`@p
ElseIf strType=i Then M@5KoMsB9
If isNumeric(str)=False Then str=0 +0dQORo
strTmp = str Y)5)s0}
Else @>gD1Q7v b
strTmp = str #Ul4&QVeg
End If *+NZQjl'
CheckInput = strTmp ZtKQ]jV&@
End Function dqL-'
B>ge,
}{
'[n)N@h
EK:Y2WZ
转自: ASP教程采集