*nods* I was looking for city and state actually. and it would need to be free. I can't drop $370 on this.
On Sun, Dec 25, 2011 at 3:48 AM, Donnie Bachan (Gmail) <donnie.bac...@gmail.com> wrote: > > Although this isn't a completely free solution we've used it with very > good success without any updates for a while now. > http://www.maxmind.com/app/geoip_features. If you are using it for > just country level access for $50 it's not a bad investment. > > I've included some code for accessing checking the IP, once you have > the database loaded. Please note that the java database is much, much > faster than using the data in a database table. > > <cffunction name="getIsBadIP" access="public" returntype="boolean" > output="false"> > <cfargument name="theIP" default="" required="false" > type="string" /> > > <cfset var isBadIP = false /> > <cfset var clientip = arguments.theIP /> > <cfset var aIPParts = '' /> > <cfset var iIPNum = '' /> > <cfset var getIP = '' /> > <cfset var getBlackListed = '' /> > > <!--- If no IP passed use CGI.REMOTE_ADDR if exists ---> > <cfif not len(clientIP)> > <cfif structKeyExists(CGI,"REMOTE_ADDR") and len > (CGI.REMOTE_ADDR)> > <cfset clientip = CGI.REMOTE_ADDR /> > </cfif> > </cfif> > <!--- Check that this is a valid country, if not no actions to > be > performed ---> > > <!--- Perform the GEOIP limiting ---> > <!--- Check if the IP address is provided ---> > <cfif len (clientIP)> > <cfset aIPParts = listToArray(clientip, ".") /> > <cfif arrayLen(aIPParts) eq 4 and > isNumeric(aIPParts[1]) and > isNumeric(aIPParts[2]) and isNumeric(aIPParts[3]) and > isNumeric(aIPParts[4])> > <cfset iIPNum = (aIPParts[1] * (256^3)) + > (aIPParts[2] * (256^2)) > + (aIPParts[3] * (256^1)) + (aIPParts[4]) /> > <cfquery name="getIP" > datasource="#getDatasource()#"> > SELECT TOP 1 country FROM GeoIP > WHERE > CAST(#iIPNum# AS bigint) between > CAST(begin_num AS bigint) and > CAST(end_num AS bigint) > </cfquery> > <!--- Check if the country is in the bad range > ---> > <cfif getIP.recordcount> > <cfquery name="getBlackListed" > datasource="#getDatasource()#"> > SELECT * FROM countryBlacklist > WHERE country = <cfqueryparam > cfsqltype="cf_sql_varchar" > value="#getIP.country#" /> > </cfquery> > <cfif getBlackListed.recordcount> > <cfset isBadIP = true /> > </cfif> > </cfif> > </cfif> > > </cfif> > > > <cfreturn isBadIP /> > </cffunction> > > Hope this helps. > > Best Regards, > Donnie Bachan > "Nitendo Vinces - By Striving You Shall Conquer" > ====================================================================== > The information transmitted is intended only for the person or entity to > which it is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use of, or > taking of any action in reliance upon, this information by persons or > entities other than the intended recipient is prohibited. If you received > this in error, please contact the sender and delete the material from any > computer. > > > > On Sun, Dec 25, 2011 at 5:56 AM, Phillip Vector > <vec...@mostdeadlygame.com> wrote: >> >> Is there a server side solution for GeoIP that I can use? I'd like to >> make up some CF code that can detect when sites are connecting in >> areas we don't serve and direct them to a different page. Is there any >> (f ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349239 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm