An ASP function to resolve SQL injection vulnerabilities

Source: Internet
Author: User
Tags numeric sql injection
function | The solution function is very simple, mainly for strings and numbers of two types of incoming data processing, specific use:

of the character type
strUserName = Checkinput (Request ("username"), "s")
of numeric types
id = checkinput (Request ("id"), "I"

Here is the function


Function Checkinput (Str,strtype)
' Function function: Filter single quotation marks in character arguments, judge numeric parameters, and assign 0 if not a numeric type
' parameter meaning: str----The parameters to be filtered
' strtype----parameter types, divided into characters and numbers, character "s" and "I" in digital form.
Dim strtmp
strtmp = ""
If strtype = "s" Then
strtmp = Replace (Trim (str), "'", "" ")
ElseIf strtype= "I" Then
If isnumeric (str) =false Then str= "0"
strtmp = str
Else
strtmp = str
End If
Checkinput = strtmp
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.