User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 332,778 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,830 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Nov 6th, 2005
Views: 3,873
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.
Last edited : Oct 29th, 2006.
asp Syntax | 5 stars
  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 (Newest First)
ilovelanerzroom | Unverified User | Dec 20th, 2006
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 9:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC