Hi Duncan,
This looks great, I'm just not sure how to install the custom tag. Can you help please?
Thanks, Jenny
Jenny Admin and Development, chicksNchaps http://www.chicksNchaps.co.uk
----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 22, 2004 12:49 PM
Subject: Re: [ cf-dev ] IP and whois
missed out a bit, here's an example of how you could use it (included a few
bogus addresses):
<cfset IPList = "2.6.190.57, 12.3.248.184, 24.230.192.0, 61.247.224.0, 212.124.240.0, 217.77.241.204, 217.168.0.0, 192.191.138.0, , 1.1.1.1.1, a.1.2, 1.2.3, a.b.c.1">
<cfloop list="#IPList#" index="IPAddress"> <cfset IP_Country = ""> <cfset IP_CountryCode = ""> <cfset IP_Error = "">
<cf_CountryIPWhois IPAddress="#IPAddress#">
<cfoutput> <cfif Len(IPAddress)>IPAddress: #IPAddress#<br></cfif> <cfif Len(IP_Country)>IP_Country: #IP_Country#<br></cfif> <cfif Len(IP_CountryCode)>IP_CountryCode: #IP_CountryCode#<br></cfif> <cfif Len(IP_Error)>IP_Error: #IP_Error#</cfif> </cfoutput> <br> </cfloop>
[EMAIL PROTECTED]
sign.co.uk To: <[EMAIL PROTECTED]>
cc:
22/09/2004 12:47 Subject: Re: [ cf-dev ] IP and whois
Please respond to dev
get the .csv list here, either free or not-so-free: http://www.maxmind.com/app/geoip_country
store it in a table.
use this code as your custom tag, call it CountryIPWhois.cfm:
<cfparam name="Attributes.IPAddress" default="">
<cfif NOT Len(Attributes.IPAddress)> <!--- Find out the user's IP address, and from this work out the country ---> <cfset Attributes.IPAddress = CGI.REMOTE_ADDR> </cfif>
<cfset Attributes.IPAddress = Trim(Attributes.IPAddress)>
<cfif Len(Attributes.IPAddress)> <!--- we have an IP address ---> <!--- check it has 4 parts ---> <cfif ListLen(Attributes.IPAddress, ".") EQ 4> <!--- split it up into the 4 parts ---> <cfset w = ListGetAt(Attributes.IPAddress, 1, ".")> <cfset x = ListGetAt(Attributes.IPAddress, 2, ".")> <cfset y = ListGetAt(Attributes.IPAddress, 3, ".")> <cfset z = ListGetAt(Attributes.IPAddress, 4, ".")>
<cfif IsNumeric(w) AND IsNumeric(x) AND IsNumeric(y) AND IsNumeric(z)> <!--- all parts are numeric ---> <cfset IPNumber = (16777216*w) + (65536*x) + (256*y) + z>
<!--- query the database to find out what country this IP address belongs to ---> <cfquery name="getCountry" datasource="CountryIPWhois"> SELECT CountryCode, Country FROM IPCountry WHERE #IPNumber# >= IPNumberStart AND #IPNumber# <= IPNumberEnd </cfquery>
<cfif getCountry.RecordCount GT 0> <cfset CALLER.IP_CountryCode = getCountry.CountryCode> <cfset CALLER.IP_Country = getCountry.Country> <cfelse> <cfset CALLER.IP_Error = "Error: IP address not found in database"> </cfif> <cfelse> <cfset CALLER.IP_Error = "Error: Part of the IP address isn't numeric"> </cfif> <cfelse> <cfset CALLER.IP_Error = "Error: IP address must have 4 parts seperated by dots"> </cfif> <cfelse> <cfset CALLER.IP_Error = "Error: No IP address found"> </cfif>
call it like this: <cf_CountryIPWhois IPAddress="#IPAddress#">
"Jenny"
<[EMAIL PROTECTED] To: <[EMAIL PROTECTED]> place.org> cc:
Subject: Re: [ cf-dev ] IP and whois 22/09/2004
12:37
Please respond
to dev
could well be if i don't figured out the cfx ... thanks Tom. Going to try the freebie way first.
Jenny Admin and Development, chicksNchaps http://www.chicksNchaps.co.uk ----- Original Message ----- From: Tom Smith To: [EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 11:52 AM Subject: Re: [ cf-dev ] IP and whois
we use ip2location any use to you?
http://www.ip2location.com/ ----- Original Message ----- From: Jenny To: [EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 11:40 AM Subject: [ cf-dev ] IP and whois
Hi all,
Anyone know of a util that will look up an ip address and update a database with country location?
ie, I log the remote_addr .. the util scans the ip's in the database and updates a country field based on the lookup. Loads of whois stuff out there if i wanted to do it one by one, but it'd be nice to automate it, especially with the volumes we deal with.
thanks,
Jenny Admin and Development, chicksNchaps http://www.chicksNchaps.co.uk
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.766 / Virus Database: 513 - Release Date: 18/09/2004
-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:- *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com* *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com* *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:- *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com* *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com* *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
--
These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*
To unsubscribe, e-mail: [EMAIL PROTECTED]
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 18/09/2004
-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by
activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*To unsubscribe, e-mail: [EMAIL PROTECTED]
