Search Tools Links Login

Detect User's IP address and filter based on it


If you have the need to filter out certain users from your site (hackers, unauthorized personel, etc.) and you know their IP address, you can use this code to do so. It detects the IP address of the current user and based on what that address is, takes action. Of course, you need to replace the IP address and the action in the code with whatever you would like to do...

Original Author: Ian Ippolito (vWorker)

Code

<%@ Language=VBScript %>
<%option explicit
'get user's ip address
dim strUserIpAddress
strUserIpAddress = Request.ServerVariables("REMOTE_ADDR")
'check if this
If strUserIpAddress = "14.10.0.1" then ' put your IP here
Response.write "You've been banned from this site!"
Else
Response.write "Welcome to the site!"
End If
%>

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 126 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.