This'd probably be a good place to use regex:


To block 123.123.123.*:


<cfif REFind("123\.123\.123\..{1,3}", cgi.remote_addr)>
    ...block...
</cfif>


To block 123.123.*.*:


<cfif REFind("123\.123\..{1,3}\..{1,3}", cgi.remote_addr)>
    ...block...
</cfif>


And so on...


(This is off top of my head, and I'm not the best regexer - someone else
may have a better way.)

-----Original Message-----
From: Uwe Degenhardt [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 8:45 AM
To: CF-Talk
Subject: Re[2]: How to Ban IP Addresses


Hi, I did that once with something like the following
code to block IPs of certain countries:

<cflock timeout="10" throwontimeout="Yes" name="geoLocatorLOCK"
type="EXCLUSIVE">
<cfinclude template="geoLocatorLIB.cfm">
<cfscript>
acceptableCountries="BE,DK,LU,..."; //could be pulled from db or
ini file at app start up
ok=init();
if (ok)

thisCountry=findCountry(cgi.REMOTE_ADDR,cgi.HTTP_ACCEPT_LANGUAGE);
</cfscript>
</cflock>
<!--- <cfif ok> --->
<cfif listFindNoCase(acceptableCountries,thisCountry)>
   <cflocation url=""> <cfelse>
   Sorry, you don't have permission to access this page !<br>
   If your require access please send an eMail to: <a
href="" PROTECTED]">[EMAIL PROTECTED]</a>
</cfif>

You can get the CF5-version of
GeoLocator from:
http://cftools.sdsolutions.de
(Thanks Paul !)

Uwe
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to