Asp是一门容易上手的语言,一般的菜鸟都用的得心应手,新手往往就已经能够编出看来比较完美的动态网站,在功能上,老手能做到的,新手也能够做到。那么新手与老手就没区别了吗?这里面区别可就大了,只不过外行人很难一眼就看出来罢了。在界面的友好性、运行性能以及网站的安全性方面是新手与老手之间区别的三个集中点。而在安全性方面,新手最容易忽略的问题就是SQL注入漏洞的问题。下面是一个SQL防注入过滤涵数,只要你把它应用到你的程序中,一切就OK了。
Function Checkstr(Str)
If Isnull(Str) Then
CheckStr = ""
Exit Function
End If
Str = Replace(Str,Chr(0),"", 1, -1, 1)
Str = Replace(Str, """", """, 1, -1, 1)
Str = Replace(Str,"<;","<;", 1, -1, 1)
Str = Replace(Str,">;",">;", 1, -1, 1)
Str = Replace(Str, "script", "script", 1, -1, 0)
Str = Replace(Str, "SCRIPT", "SCRIPT", 1, -1, 0)
Str = Replace(Str, "Script", "Script", 1, -1, 0)
Str = Replace(Str, "script", "Script", 1, -1, 1)
Str = Replace(Str, "object", "object", 1, -1, 0)
Str = Replace(Str, "OBJECT", "OBJECT", 1, -1, 0)
Str = Replace(Str, "Object", "Object", 1, -1, 0)
Str = Replace(Str, "object", "Object", 1, -1, 1)
Str = Replace(Str, "applet", "applet", 1, -1, 0)
Str = Replace(Str, "APPLET", "APPLET", 1, -