Advertisement
2002C Classes/ Frameworks/ OOP #17135

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...

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
<%@ 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 
%>
Original Comments (3)
Recovered from Wayback Machine