Anti-ASP Injection Ultimate Precaution _ Application Skills

Source: Internet
Author: User
Tags chr sql injection
Here are 4 functions that are enough to withstand all SQL injection vulnerabilities! Read the code and you can digest it.

Be careful to filter all Request objects: including Request.cookie, request. ServerVariables and so on are easily overlooked objects:

Program code
Copy Code code as follows:

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 parameters
If Len (S1) =0 then
killw= "
Else
Killw=trim (replace (S1," ', ""))
End If
End Function
Br>function Killbad (ByVal s1) filters all dangerous characters, including cross-site scripting
If len (S1) = 0 Then
killbad= ""
else
Killbad = Trim (r Eplace (replace (replace (replace (S1,CHR (10), 〈br〉), Chr (34), "" ")," "," > "," "" , "<"), "&", "&"), Chr (+), "'"), Chr (), ""), Chr (), ""))
End If
End Function
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.