943,398 Members | Top Members by Rank

Ad:
  • ASP Code Snippet
  • Views: 1428
  • ASP RSS
0

Blocking an IP adress to a certain page

by on Nov 6th, 2005
This is a small function that will block the specific IP from viewing the certain page, and it will redirect the user to the main page or noaccess page.
ASP Code Snippet (Toggle Plain Text)
  1. <%
  2. '''''''''''''''''''''''''''''''
  3. ' Block the IP addresses that do the SPAM
  4. '''''''''''''''''''''''''''''''
  5. Function IsBlockedIP()
  6. Dim UserIP
  7. Dim BlockedIParray(2)
  8. 'assign our blocked IP addresses to our array
  9. BlockedIParray(0) = "60.0.201.209"
  10. BlockedIParray(1) = "218.11.15.212"
  11. 'retrieve the visitors IP address
  12. UserIP = Request.ServerVariables("REMOTE_ADDR")
  13.  
  14. 'loop through the Blocked IPs
  15. For i = 0 to UBound(BlockedIParray)
  16. If UserIP = BlockedIParray(i) Then
  17. Response.Redirect "index.asp"
  18. 'Response.Redirect "noaccess.asp"
  19.  
  20. End If
  21. Next
  22. End Function
  23. %>
Comments on this Code Snippet
Sep 28th, 2009
0

Re: Blocking an IP adress to a certain page

I think I finished work this code. I want to restrict a page where someone comes from abroad to show another page and when the national network to the actual page opens.
This code which should be put in the php file?
I'm not familiar so much for help.
Thank you
Newbie Poster
perosf is offline Offline
24 posts
since Sep 2009
Oct 20th, 2009
0

Re: Blocking an IP adress to a certain page

thanks
Newbie Poster
yonker is offline Offline
13 posts
since Oct 2009
Message:
Previous Thread in ASP Forum Timeline: Put Record in a Textbox
Next Thread in ASP Forum Timeline: Display Random Banners





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC