I would construct a rule from the ban database. If the code encounters an asterisk in the ban field, it should construct a string that includes the address up to the subnet mask:
<Cfquery name="mybannedips" datasource="ofs">
select ip_addr from bannedips
</CFQUERY>
<cfset banstring="">
<cfoutput query="mybannedips">
<cfif find("*",ip_addr)>
<cfset banstring = banstring & mid(ip_addr,1,find("*",ip_addr)-1)&",">
<cfelse>
<cfset banstring = banstring & ip_addr & ",">
</cfif>
</cfoutput>
<cfset banstring = mid(banstring,1,len(banstring)-1)>
<cfoutput>#banstring#</cfoutput> is our list of bad boys.<br><br>
<!---Now, you can compare the entire remote address to the values in banstring. --->
<cfset testip = "153.2.2.5">
<cfloop index="badboy" list="#banstring#">
<cfif right(badboy,1) is ".">
<cfif testip contains badboy>
<cfoutput>#testip#</cfoutput> is a Group Loser.<br>
</cfif>
<cfelse>
<cfif trim(testip) is trim(badboy)>
<cfoutput>#testip#</cfoutput> is a Lone Loser.<br>
</cfif>
</cfif>
</cfloop>
HTH,
Phil Hegedusich