zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

几个比较好用的asp检查函数

ASP 函数 比较 几个 检查 好用
2023-09-27 14:28:42 时间
因为比较简单,我就不说什么了。一看就明白的! Function ChkStr(InString)If InString Then?InString=Replace(LCase(InString), , )?InString=Replace(LCase(...

因为比较简单,我就不说什么了。一看就明白的!

Function ChkStr(InString)
If InString"" Then
?InString=Replace(LCase(InString)," ","")
?InString=Replace(LCase(InString),";","")
?InString=Replace(LCase(InString),"","")
?InString=Replace(LCase(Instring),"--","")
?Instring=Replace(LCase(Instring),"%","")
?InString=Replace(LCase(InString),"%20","")
?
?InString=Replace(LCase(InString),"admin","")
?
?InString=Replace(LCase(InString),"and","")
?InString=Replace(LCase(InString),"or","")
?
?InString=Replace(LCase(InString),"asc","")
?InString=Replace(LCase(Instring),"chr","")
?InString=Replace(LCase(InString),"mid","")
?InString=Replace(LCase(InString),"len","")
?
?InString=Replace(LCase(InString),"select","")
?InString=Replace(LCase(InString),"insert","")
?InString=Replace(LCase(InString),"delete","")
?InString=Replace(LCase(InString),"update","")
?
?
?ChkStr=InString
End If
End Function

Function CheckFileExt(FileExt)
?Dim FileAccessExt,AccessExt
?AccessExt="gif,jpg,jpeg,bmp,doc,txt,png"
?FileAccessExt=Split(AccessExt,",")
?For i=LBound(FileAccessExt) to UBound(FileAccessExt)
??If LCase(FileExt)=LCase(FileAccessExt(i)) Then
???CheckFileExt=True
??Else
???CheckFileExt=False
??End If
?Next
End Function

Function CheckStr(str,IsStr)
CheckStr=str
If IsStr And InStr(str,",") 0 Then
?Call errmsg("提交字符中包含非法字符")
ElseIf (Not IsStr) And (Not IsNumeric(str)) Then
?Call errmsg("提交不是数字型")
End If
End Function

Sub errmsg(str)
?If Not IsNull(str) Then
??Response.Write(str) " lt br gt"
??Call ASCpy()
??Response.End()? Very Improtan.Stop execute program.
?End If
End Sub
?

?Sub ASCpy()
?Response.Write ""
?Response.Write "

"
??? Response.Write("Error happed!
Please Contract ")
?Response.Write("Name:")
?Response.Write("AloneSword")
?Response.Write("
.
Thank you!!!
")
?Response.Write "Copyright © By 建大网络
"
??? Response.Write "Last Modified:21/08/2004
"
?Response.Write("Author:AloneSword")
?Response.Write ""
End Sub

?

小结:

最值得学习的还是response.End()的合理使用,非常的好。只要出现错误马上终止程序的运行,不给后面的机会,保证数据的安全。


有关Asp里Split函数使用多个分割符的方法 首先,我在知道Split这个函数的作用,是把一个字符串按指定的分割符分割成一个字符串数组。ASP里有这个Split,是这样定义的dim Split(byval source as string ,byval str as string) as string()source是源字符串,str是分隔符我这里用了VB.net的写法,方便说明返回值的类型和参数的类型。
有关ASP的过程及函数的定义方法及调用 定义过程 定义函数 调用方法从上面可以看出ASP的定义可以说是很不严格的,参数都没有类型的定义,函数的返回类型也没有定义如果这样调用call a1( aowind ,6) 则回返回数据类型不适配的错误了....
一个比较使用的asp 函数集合类 最近迷恋上作网站了,使用asp开发,发现asp有好多的漏洞,而且在一个网站中有好多的代码是重复使用的,所以就查询了一些资料发现在asp中可以使用类的思想,所以就写了这个类,写的不好,但是比较实用。
asp的ubb函数总结 asp的ubb函数 function unHtml(content) unHtml=content if content then unHtml=replace(unHtml, , ) unHtml=replace(unHt...