Re: where else can this list be found? [message #170650 is a reply to message #170649] |
Sat, 13 November 2010 06:10 |
|
richard
Messages: 213 Registered: June 2013
Karma:
|
Senior Member |
|
|
On Fri, 12 Nov 2010 20:14:55 -0800, Mike S wrote:
> On 11/12/2010 7:38 PM, richard wrote:
>> On Fri, 12 Nov 2010 18:50:09 -0800, Mike S wrote:
>>
>>> On 11/12/2010 1:57 PM, richard wrote:
>>>> http://krakjoe.com/geoip/query=code&address=remote
>>>>
>>>> I found this code I would like to use as a spam blocker.
>>>> Since it calls the information from a file rather than an array.
>>>> I could make up my own file to install on my site.
>>>> I just need to know where I can get the same basic information as this site
>>>> is apparently gone.
>>>>
>>>> <?php
>>>> # array of country codes you wanna block
>>>> $block_countries = array(
>>>> 'GB',
>>>> 'US'
>>>> );
>>>> # grab the country code from krakjoe.com
>>>> if( !in_array( file_get_contents(
>>>> 'http://krakjoe.com/geoip/query=code&address=remote' ), $block_countries )
>>>> ) :
>>>> # the following page will only be displayed to users who have a country
>>>> code that is NOT in the array at the top of the example
>>>> ?>
>>>> <html>
>>>> <head>
>>>> <title>You're allowed to view this page</title>
>>>> </head>
>>>> <body>
>>>> viewing the page, oh yeah baby .....
>>>> </body>
>>>> </html>
>>>> <?php
>>>> endif;
>>>> ?>
>>>>
>>>>
>>>> I would change the !in_array to in_array then send those blocked to a
>>>> specific page before they even get into my forum site.
>>>
>>> Will these get you started: 2 pages with easy to grab data, and the
>>> wikipedia page about it:
>>>
>>> English country names and code elements
>>>
>>> This list states the country names (official short names in English) in
>>> alphabetical order as given in ISO 3166-1 and the corresponding ISO
>>> 3166-1-alpha-2 code elements.
>>> This list is updated whenever a change to the official code list in ISO
>>> 3166-1 is effected by the ISO 3166/MA.
>>> It lists 246 official short names and code elements.
>>>
>>> http://www.iso.org/iso/english_country_names_and_code_elements
>>> -----------------------------------------------------------------------
>>> Country Codes
>>>
>>> The International Organization for Standardization (ISO) under its
>>> standard ISO 3166 has established two-letter (2-alpha) and three-letter
>>> (3-alpha) codes for the various countries of the world, including
>>> independent states, dependent areas, and certain areas of contested
>>> jurisdiction or special status. These codes are published and revised
>>> when needed by the ISO 3166 Maintenance Agency.
>>>
>>> http://www.unc.edu/~rowlett/units/codes/country.htm
>>> -----------------------------------------------------------------------
>>> ISO 3166-1 alpha-2
>>>
>>> ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO
>>> 3166-1, part of the ISO 3166 standard published by the International
>>> Organization for Standardization (ISO), to represent countries,
>>> dependent territories, and special areas of geographical interest. They
>>> are the most widely used of the country codes published by ISO (the
>>> others being alpha-3 and numeric), and are used most prominently for the
>>> Internet's country code top-level domains (with a few exceptions).[1]
>>> They were first included as part of the ISO 3166 standard in its first
>>> edition in 1974
>>>
>>> http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
>>
>> Perhaps I should ask, how could I resolve an IP to a country code?
>>
>> In my forum, I recently revamped my spammer IP list and wound up with
>> basically 50 main ip's that cover what I don't want in.
>> Problem is, the way it is set up, the IP block doesn't take effect until
>> the visitor does something, such as trying to register.
>> What I want to do is to check the IP from the beginning, and if it's on the
>> list, kick them off to another page.
>>
>> I've seen a few sites that show how to do this but none show how to do it
>> with a wildcard scheme. With this script, using the external file would
>> help a lot.
>>
>> Got any sites that would show how to use the wildcard scheme properly?
>
> There are free databases to get a country code from an IP e.g.
>
> http://software77.net/geo-ip/
That's what I used to build my IP list with. Gives a bit more info than
other sites do.
|
|
|