Using ASP IP method to prevent fixed IP spam message

Source: Internet
Author: User
Tags execution final get ip servervariables

<%
Dim Ip,ipstring,visitip
' The IP address to be banned
Ipstring= "|195.225.177.34|195.225.177.137|72.232.250.10|"
' Get IP Address
IP = Request.ServerVariables ("Http_x_forwarded_for")
If IP = "" Then
IP = Request.ServerVariables ("REMOTE_ADDR")
End If
Visitip= "|" &IP& "|"
If InStr (1,ipstring,visitip) >0 Then
Response.Write "Your IP is forbidden to leave a message, if necessary, please contact the webmaster." If you are sending rubbish, advise you to stop! "
Response.End
End If
' Response. Write ("Your IP:" &IP& "access to this site")
%>

Note: Remember to embed this code in the head of the final execution page (not necessarily for the message publishing page), most of the garbage is directly post data to the execution page. It is recommended that you change the file name of the final execution page and the action in the Form tab of the page with which the link is posted.



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.