An effective method to prevent ASP injection

Source: Internet
Author: User
Tags chr trim
  code is as follows copy code


function Killn (ByVal s1) ' filter numeric parameter
if not IsNumeric (S1) then
killn=0
Else
if s1〈0 or s1〉2147483647 then
Killn=0
Else
killn=clng (S1)
End-if
end-if
End Function

Function KILLC (ByVal s1) Filter Currency parameters if not isnumeric (S1) then
killc=0
Else
Killc=formatnumber (s1,2,-1,0,0)
End If
End function

Function Killw (ByVal s1) ' filter character parameter
If Len (S1) =0 then
killw= ""
Else is
Killw=trim (replace (S1, "'", "")) The
End If
End Function

Function Killbad (ByVal s1) filters all dangerous characters, including cross-station scripting
If Len (s1) = 0 Then
killbad= "" br> else
Killbad = Trim (replace (replace (replace) (replace (S1,CHR (10), "〈br〉"), CHR (34), "" "," "," > ")," ["," < ")," & "," & "), Chr (()," ' "), Chr ()," "), Chr ()," "))
End If
End func tion

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.