[thelist] CFMX: IP Address Ban/Prevent

Joshua Olson joshua at waetech.com
Wed Feb 25 15:20:48 CST 2004


> -----Original Message-----
> From: Matt Shooks
> Sent: Wednesday, February 25, 2004 3:47 PM
> 
> Hello Russ,
> 
> You could create a table similar to this:
> 
> CREATE TABLE [dbo].[BannedIPs] (
> 	[Octet1] [tinyint] ,
> 	[Octet2] [tinyint] NULL ,
> 	[Octet3] [tinyint] NULL ,
> 	[Octet4] [tinyint] NULL
> )

Matt,

If you want to do it this way, there is a much easier query,

<cfquery name="IPCheck">
SELECT 1
FROM BannedIPs
WHERE 192 = Coalesce(Octet1, 192)
  AND 168 = Coalesce(Octet2, 168)
  AND 2 = Coalesce(Octet3, 2)  
  AND 255 = Coalesce(Octet4, 255)
</cfquery>

<cfif IPCheck.RecordCount>
<p>You have been BANNED!!!</p>
<cfabort>
</cfif>

Good luck,

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 



More information about the thelist mailing list