Asp get and post data receiving and filtering

Source: Internet
Author: User

Copy codeThe Code is as follows: <%
'-------- Definition section ------------------
Dim XH_Post, XH_Get, XH_In, XH_Inf, XH_Xh, XH_db, XH_dbstr
'Custom string to be filtered, separated by '|'
XH_In = "'|; | and | exec | insert | select | delete % 20from | update | count | * | % | chr | mid | master | truncate | char | declare | drop % 20table | from | net % 20user | xp_mongoshell |/add | net % 20 localgroup % 20administrators | Asc | char"
'----------------------------------
%>
<%
XH_Inf = split (XH_In, "| ")
'-------- POST part ------------------
If Request. Form <> "" Then
For Each XH_Post In Request. Form
For XH_Xh = 0 To Ubound (XH_Inf)
If Instr (LCase (Request. Form (XH_Post), XH_Inf (XH_Xh) <> 0 Then
Response. Write "<Script Language = JavaScript> alert ('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:" & XH_Post "<br>"
Response. Write "submit data:" & Request. Form (XH_Post)
Response. End
End If
Next
Next
End If
'----------------------------------
'-------- GET part -------------------
If Request. QueryString <> "Then
For Each XH_Get In Request. QueryString
For XH_Xh = 0 To Ubound (XH_Inf)
If Instr (LCase (Request. QueryString (XH_Get), XH_Inf (XH_Xh) <> 0 Then
Response. Write "<Script Language = JavaScript> alert ('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:" & XH_Get "<br>"
Response. Write "submit data:" & Request. QueryString (XH_Get)
Response. End
End If
Next
Next
End If
'----------------------------------
%>
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.