ASP Web page anti-SQL Injection code

Source: Internet
Author: User
<%
'-------- Definition section ------------------
Dim fy_post, fy_get, fy_in, fy_inf, fy_xh, fy_db, fy_dbstr
'Custom string to be filtered, separated by "defense"
Fy_in = "'anti-; and anti-exec anti-insert anti-select anti-delete anti-update anti-count anti-* anti-% anti-CHR anti-mid anti-master anti-truncate anti-Char anti-declare"
'----------------------------------
%>

<%
Fy_inf = Split (fy_in, "anti-DDoS ")
'-------- Post part ------------------
If request. Form <> "" then
For each fy_post in request. Form

For fy_xh = 0 to ubound (fy_inf)
If instr (lcase (request. Form (fy_post), fy_inf (fy_xh) <> 0 then

Response. Write "<script language = JavaScript> alert ('System prompt! : Please do not include invalid characters in the parameter to try to inject! '); </SCRIPT>"
Response. Write "illegal operation! The system makes the following records: <br>"
Response. Write "Operation IP:" & request. servervariables ("remote_addr") & "<br>"
Response. Write "operation time:" & now & "<br>"
Response. Write "Operation page:" & request. servervariables ("url") & "<br>"
Response. Write "submission method: Post <br>"
Response. Write "Submit parameters:" & fy_post & "<br>"
Response. Write "submit data:" & request. Form (fy_post)
Response. End
End if
Next

Next
End if
'----------------------------------

'-------- Get part -------------------
If request. querystring <> "then
For each fy_get in request. querystring

For fy_xh = 0 to ubound (fy_inf)
If instr (lcase (request. querystring (fy_get), fy_inf (fy_xh) <> 0 then

Response. Write "<script language = JavaScript> alert ('System prompt! : Please do not include invalid characters in the parameter to try to inject! '); </SCRIPT>"
Response. Write "illegal operation! The system makes the following records: <br>"
Response. Write "Operation IP:" & request. servervariables ("remote_addr") & "<br>"
Response. Write "operation time:" & now & "<br>"
Response. Write "Operation page:" & request. servervariables ("url") & "<br>"
Response. Write "submission method: Get <br>"
Response. Write "Submit parameters:" & fy_get & "<br>"
Response. Write "submit data:" & request. querystring (fy_get)
Response. End
End if
Next
Next
End if
%>

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.