FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » where else can this list be found?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: where else can this list be found? [message #170649 is a reply to message #170646] Sat, 13 November 2010 04:14 Go to previous messageGo to previous message
Mike S is currently offline  Mike S
Messages: 8
Registered: September 2010
Karma:
Junior Member
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/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Why don't I get a deprecation warning?
Next Topic: Variable expansion <?=$foo?> not working anymore
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 07:31:32 GMT 2024

Total time taken to generate the page: 0.04687 seconds