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

Home » Imported messages » comp.lang.php » recognize country
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
recognize country [message #184180] Sat, 14 December 2013 13:43 Go to next message
nawfer is currently offline  nawfer
Messages: 34
Registered: August 2011
Karma: 0
Member
which code to use for send page
x
y
z
depending by user's nation?
Re: recognize country [message #184181 is a reply to message #184180] Sat, 14 December 2013 13:58 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/14/2013 8:43 AM, nawfer wrote:
> which code to use for send page
> x
> y
> z
> depending by user's nation?
>

How are you going to find the users nation? IP address is not reliable.

Let's try a different question. What are you trying to accomplish?


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: recognize country [message #184182 is a reply to message #184180] Sat, 14 December 2013 15:27 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 14/12/13 13:43, nawfer wrote:
> which code to use for send page
> x
> y
> z
> depending by user's nation?
>
almost impossible to RELIABLY detect nation by means of IP address - and
what about French speakers on holiday in Zululand, anyway?

So mostly let user select a country and set a cookie, or redirect to a
country specific part of the site.



--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: recognize country [message #184183 is a reply to message #184180] Sat, 14 December 2013 15:32 Go to previous messageGo to next message
Lew Pitcher is currently offline  Lew Pitcher
Messages: 60
Registered: April 2013
Karma: 0
Member
On Saturday 14 December 2013 08:43, in comp.lang.php, "nawfer"
<novalidsforspam(at)alt(dot)al> wrote:

> which code to use for send page
> x
> y
> z
> depending by user's nation?

It is not possible to do this *reliably*.

You can /infer/ location (and, thus, country) from the client's IP address
($_SERVER["REMOTE_ADDR"]) and various third-party tools, but this location
is often practically inaccurate, and is theoretically not usable at all.

As for techniques and third-party tools, Let Me Google That For You
http://lmgtfy.com/?q=IP+geolocation

Please note that it *is possible* to have, for instance, an IP address
nominally from a European source, originating from North America, or vice
versa. And, let's not forget tools like Tor, that provide "country-local"
IP addresses for remote systems, by way of an encrypted piping mechanism.

--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
Re: recognize country [message #184184 is a reply to message #184180] Sat, 14 December 2013 18:55 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
nawfer wrote:

> which code to use for send page
> x
> y
> z
> depending by user's nation?
>

Do you really want to send a specific "page" depending on the visitors
*country*, or do you want to distinguish between different *languages*?
For the latter you can use the accept-language header[1] sent by the
browser.

[1] <http://tools.ietf.org/search/rfc2616#section-14.4>

And please do not cross-post.

--
Christoph M. Becker
Re: recognize country [message #184185 is a reply to message #184184] Sat, 14 December 2013 19:52 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/14/2013 1:55 PM, Christoph Michael Becker wrote:
> nawfer wrote:
>
>> which code to use for send page
>> x
>> y
>> z
>> depending by user's nation?
>>
>
> Do you really want to send a specific "page" depending on the visitors
> *country*, or do you want to distinguish between different *languages*?
> For the latter you can use the accept-language header[1] sent by the
> browser.
>
> [1] <http://tools.ietf.org/search/rfc2616#section-14.4>
>
> And please do not cross-post.
>

Actually, cross-posting is the PREFERRED way of posting to multiple
(appropriate) newsgroups. Multi-posting is frowned upon, though.

In this case, both newsgroups he posted to were appropriate for the
subject (at least based on current information).


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Cross-Posting (was: recognize country) [message #184186 is a reply to message #184185] Sat, 14 December 2013 20:57 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
Jerry Stuckle wrote:

> On 12/14/2013 1:55 PM, Christoph Michael Becker wrote:
>>
>> And please do not cross-post.
>
> Actually, cross-posting is the PREFERRED way of posting to multiple
> (appropriate) newsgroups. Multi-posting is frowned upon, though.

However, asking a question in multiple newsgroups might easily lead to
separate discussions even when the OP was *cross*-posted, what is not
preferable, IMHO. And as I do not prefer to (cross-)post to newsgroups
which I am not subscribed to, because I might miss an important reply,
my reply already has split the discussion.

> In this case, both newsgroups he posted to were appropriate for the
> subject (at least based on current information).

Isn't *anything* that is on topic here also on topic in alt.php?

--
Christoph M. Becker
Re: Cross-Posting [message #184187 is a reply to message #184186] Sat, 14 December 2013 21:20 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/14/2013 3:57 PM, Christoph Michael Becker wrote:
> Jerry Stuckle wrote:
>
>> On 12/14/2013 1:55 PM, Christoph Michael Becker wrote:
>>>
>>> And please do not cross-post.
>>
>> Actually, cross-posting is the PREFERRED way of posting to multiple
>> (appropriate) newsgroups. Multi-posting is frowned upon, though.
>
> However, asking a question in multiple newsgroups might easily lead to
> separate discussions even when the OP was *cross*-posted, what is not
> preferable, IMHO. And as I do not prefer to (cross-)post to newsgroups
> which I am not subscribed to, because I might miss an important reply,
> my reply already has split the discussion.
>

Yes, because YOU changed the posting newsgroup. Don't change list of
newsgroups being cross-posted to.

Whether YOU prefer it or not is immaterial. It is the accepted practice
on Usenet. A good description can be found at
http://en.wikipedia.org/wiki/Crossposting.

>> In this case, both newsgroups he posted to were appropriate for the
>> subject (at least based on current information).
>
> Isn't *anything* that is on topic here also on topic in alt.php?
>

Possibly. But that's life. It doesn't mean messages can't be
cross-posted to both newsgroups. And whether you read both newsgroups
or not is also immaterial. Some people may, for instance, read alt.php
but not comp.lang.php.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Cross-Posting [message #184188 is a reply to message #184186] Sat, 14 December 2013 21:38 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Christoph Michael Becker wrote:

> Jerry Stuckle wrote:
>> On 12/14/2013 1:55 PM, Christoph Michael Becker wrote:
>>> And please do not cross-post.
>>
>> Actually, cross-posting is the PREFERRED way of posting to multiple
>> (appropriate) newsgroups. Multi-posting is frowned upon, though.
>
> However, asking a question in multiple newsgroups might easily lead to
> separate discussions even when the OP was *cross*-posted, what is not
> preferable, IMHO. And as I do not prefer to (cross-)post to newsgroups
> which I am not subscribed to, because I might miss an important reply,
> my reply already has split the discussion.

If the Followup-To header field is specified properly, so as to avoid the
condition you are describing, there is no intrinsic problem with crossposts.
Mr. Stuckle is correct there.

See also [de] <http://www.liesmal.de/fup2-faq>.

>> In this case, both newsgroups he posted to were appropriate for the
>> subject (at least based on current information).
>
> Isn't *anything* that is on topic here also on topic in alt.php?

In theory, yes. But there is no alt.php except on Google Groups and similar
archives, and peculiarly maintained news servers.

The problem with *this* crosspost is that, *and* that alt.ALL – by contrast
to comp.ALL – does not belong to the Big 8. Where comp.ALL is order,
alt.ALL is anarchy; it is therefore a bad idea to crosspost to alt.ALL /and/
comp.ALL. In general, crossposting across hierarchy borders is a bad idea
for several reasons.

<https://en.wikipedia.org/wiki/Big_8_(Usenet)>


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Re: Cross-Posting [message #184189 is a reply to message #184187] Sat, 14 December 2013 22:25 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
Jerry Stuckle wrote:

> On 12/14/2013 3:57 PM, Christoph Michael Becker wrote:
>> Jerry Stuckle wrote:
>>
>>> On 12/14/2013 1:55 PM, Christoph Michael Becker wrote:
>>>>
>>>> And please do not cross-post.
>>>
>>> Actually, cross-posting is the PREFERRED way of posting to multiple
>>> (appropriate) newsgroups. Multi-posting is frowned upon, though.
>>
>> However, asking a question in multiple newsgroups might easily lead to
>> separate discussions even when the OP was *cross*-posted, what is not
>> preferable, IMHO. And as I do not prefer to (cross-)post to newsgroups
>> which I am not subscribed to, because I might miss an important reply,
>> my reply already has split the discussion.
>>
>
> Yes, because YOU changed the posting newsgroup. Don't change list of
> newsgroups being cross-posted to.
>
> Whether YOU prefer it or not is immaterial. It is the accepted practice
> on Usenet. A good description can be found at
> http://en.wikipedia.org/wiki/Crossposting.

My apologies -- I wasn't aware that changing the list of newsgroups
being cross-posted to is frowned upon. Thanks for pointing that out. :)

--
Christoph M. Becker
Re: Cross-Posting [message #184190 is a reply to message #184188] Sat, 14 December 2013 22:31 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
Thomas 'PointedEars' Lahn wrote:

> Christoph Michael Becker wrote:
>
>> Jerry Stuckle wrote:
>>> On 12/14/2013 1:55 PM, Christoph Michael Becker wrote:
>>>> And please do not cross-post.
>>>
>>> Actually, cross-posting is the PREFERRED way of posting to multiple
>>> (appropriate) newsgroups. Multi-posting is frowned upon, though.
>>
>> However, asking a question in multiple newsgroups might easily lead to
>> separate discussions even when the OP was *cross*-posted, what is not
>> preferable, IMHO. And as I do not prefer to (cross-)post to newsgroups
>> which I am not subscribed to, because I might miss an important reply,
>> my reply already has split the discussion.
>
> If the Followup-To header field is specified properly, so as to avoid the
> condition you are describing, there is no intrinsic problem with crossposts.
> Mr. Stuckle is correct there.

Until now, I have used the follow up header only to point the discussion
to an appropriate newsgroup. Apparently, there are other good uses.
Thanks for pointing that out.

> See also [de] <http://www.liesmal.de/fup2-faq>.

It seems the domain is not accessible (for me); it responds with 403:
Forbidden.

--
Christoph M. Becker
Re: Cross-Posting [message #184191 is a reply to message #184189] Sat, 14 December 2013 22:36 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/14/2013 5:25 PM, Christoph Michael Becker wrote:
> Jerry Stuckle wrote:
>
>> On 12/14/2013 3:57 PM, Christoph Michael Becker wrote:
>>> Jerry Stuckle wrote:
>>>
>>>> On 12/14/2013 1:55 PM, Christoph Michael Becker wrote:
>>>> >
>>>> > And please do not cross-post.
>>>>
>>>> Actually, cross-posting is the PREFERRED way of posting to multiple
>>>> (appropriate) newsgroups. Multi-posting is frowned upon, though.
>>>
>>> However, asking a question in multiple newsgroups might easily lead to
>>> separate discussions even when the OP was *cross*-posted, what is not
>>> preferable, IMHO. And as I do not prefer to (cross-)post to newsgroups
>>> which I am not subscribed to, because I might miss an important reply,
>>> my reply already has split the discussion.
>>>
>>
>> Yes, because YOU changed the posting newsgroup. Don't change list of
>> newsgroups being cross-posted to.
>>
>> Whether YOU prefer it or not is immaterial. It is the accepted practice
>> on Usenet. A good description can be found at
>> http://en.wikipedia.org/wiki/Crossposting.
>
> My apologies -- I wasn't aware that changing the list of newsgroups
> being cross-posted to is frowned upon. Thanks for pointing that out. :)
>

It's not - if you're removing newsgroups which are no longer appropriate
(possibly because of the changing nature of the discussion).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Cross-Posting [message #184192 is a reply to message #184190] Sat, 14 December 2013 22:55 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Christoph Michael Becker wrote:

> Thomas 'PointedEars' Lahn wrote:
>> See also [de] <http://www.liesmal.de/fup2-faq>.
>
> It seems the domain is not accessible (for me); it responds with 403:
> Forbidden.

WFM.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Re: Cross-Posting [message #184193 is a reply to message #184192] Sat, 14 December 2013 23:08 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/14/2013 5:55 PM, Thomas 'PointedEars' Lahn wrote:
> Christoph Michael Becker wrote:
>
>> Thomas 'PointedEars' Lahn wrote:
>>> See also [de] <http://www.liesmal.de/fup2-faq>.
>>
>> It seems the domain is not accessible (for me); it responds with 403:
>> Forbidden.
>
> WFM.
>
>
> PointedEars
>

I get the same thing Christoph does. Maybe because we're not in
Germany? Or maybe we need a login?


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Cross-Posting [message #184194 is a reply to message #184193] Sat, 14 December 2013 23:35 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
Jerry Stuckle wrote:

> On 12/14/2013 5:55 PM, Thomas 'PointedEars' Lahn wrote:
>> Christoph Michael Becker wrote:
>>
>>> Thomas 'PointedEars' Lahn wrote:
>>>> See also [de] <http://www.liesmal.de/fup2-faq>.
>>>
>>> It seems the domain is not accessible (for me); it responds with 403:
>>> Forbidden.
>>
>> WFM.
>
> I get the same thing Christoph does. Maybe because we're not in
> Germany? Or maybe we need a login?

Well, I am in (and from, by the way) Germany -- however, geolocation
detection might not properly work.

Anyway, the wayback machine got the same response on Dezember 8, 2013[1].

[1]
<http://web.archive.org/web/20131208180148/http://www.liesmal.de/fup2-faq/>

--
Christoph M. Becker
Re: recognize country [message #184195 is a reply to message #184180] Sat, 14 December 2013 23:56 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Sat, 14 Dec 2013 14:43:34 +0100, nawfer wrote:

> which code to use for send page
> x
> y
> z
> depending by user's nation?

GeoIP.
This utility reporsts the country based on user's location.
But why not let the user select the proper page wotj a dropdown list?
Re: recognize country [message #184196 is a reply to message #184195] Sun, 15 December 2013 00:09 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/14/2013 6:56 PM, richard wrote:
> On Sat, 14 Dec 2013 14:43:34 +0100, nawfer wrote:
>
>> which code to use for send page
>> x
>> y
>> z
>> depending by user's nation?
>
> GeoIP.

Which is just as accurate as any other IP-based location service. IOW,
not very.

> This utility reporsts the country based on user's location.
> But why not let the user select the proper page wotj a dropdown list?
>

It all depends on what he's trying to accomplish.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Cross-Posting [message #184197 is a reply to message #184194] Sun, 15 December 2013 00:13 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Christoph Michael Becker wrote:

> Jerry Stuckle wrote:
>> On 12/14/2013 5:55 PM, Thomas 'PointedEars' Lahn wrote:
>>> Christoph Michael Becker wrote:
>>>> Thomas 'PointedEars' Lahn wrote:
>>>> > See also [de] <http://www.liesmal.de/fup2-faq>.
>>>>
>>>> It seems the domain is not accessible (for me); it responds with 403:
>>>> Forbidden.
>>>
>>> WFM.
>>
>> I get the same thing Christoph does. Maybe because we're not in
>> Germany? Or maybe we need a login?
>
> Well, I am in (and from, by the way) Germany -- however, geolocation
> detection might not properly work.
>
> Anyway, the wayback machine got the same response on Dezember 8, 2013[1].

I am in Switzerland, and it WFM in any browser on both GNU/Linux and
Windows, with clean browser cache, respectively. There is no login
required; it is a public FAQ (not by me).

I do not think any geolocation filter is used, because it was written for
the German-*speaking* Usenet which has participants worldwide. I suspect it
might be a User-Agent filter, which would also explain why the Wayback
machine could not access that resource.

> [1]
> <http://web.archive.org/web/20131208180148/http://www.liesmal.de/fup2-faq/>

Strangely enough, though, Google could access and cache it:

< http://webcache.googleusercontent.com/search?q=cache:ZDR9dnmrgkkJ:www.liesm al.de/fup2-faq/>


F'up2 comp.infosystems.www.authoring.misc

PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
Re: recognize country [message #184198 is a reply to message #184195] Sun, 15 December 2013 05:35 Go to previous messageGo to next message
Evan Platt is currently offline  Evan Platt
Messages: 124
Registered: November 2010
Karma: 0
Senior Member
On Sat, 14 Dec 2013 18:56:43 -0500, richard <noreply(at)example(dot)com>
wrote:

> GeoIP.
> This utility reporsts the country based on user's location.
> But why not let the user select the proper page wotj a dropdown list?

That's funny, you always say you can't determine a users location by
their IP.

So which is it?
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
Re: recognize country [message #184199 is a reply to message #184181] Sun, 15 December 2013 10:16 Go to previous messageGo to next message
nawfer is currently offline  nawfer
Messages: 34
Registered: August 2011
Karma: 0
Member
Il Sat, 14 Dec 2013 08:58:30 -0500, Jerry Stuckle ha scritto:

> On 12/14/2013 8:43 AM, nawfer wrote:
>> which code to use for send page
>> x
>> y
>> z
>> depending by user's nation?
>>
>
> How are you going to find the users nation? IP address is not reliable.
>
> Let's try a different question. What are you trying to accomplish?

yes is a double question
how find the users nation
and after
how send relative page
Re: recognize country [message #184200 is a reply to message #184196] Sun, 15 December 2013 10:34 Go to previous messageGo to next message
nawfer is currently offline  nawfer
Messages: 34
Registered: August 2011
Karma: 0
Member
>> GeoIP.
>
> Which is just as accurate as any other IP-based location service. IOW,
> not very.

but is a online service or one php array or both
?


but isn't stable the ip of the nations?
example
50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A
101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B
151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C

ok the ip inner nations ip can't be accurate and can to change, but between
nation is table (every range is assigned at only one nation)?
Re: recognize country [message #184201 is a reply to message #184200] Sun, 15 December 2013 10:59 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 15/12/13 11:34, nawfer wrote:
>>> GeoIP.
>>
>> Which is just as accurate as any other IP-based location service. IOW,
>> not very.
>
> but is a online service or one php array or both
> ?
>
>
> but isn't stable the ip of the nations?
> example
> 50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A
> 101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B
> 151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C
>
> ok the ip inner nations ip can't be accurate and can to change, but between
> nation is table (every range is assigned at only one nation)?
>

There are IP-numbers which is registred for say Sweden and users in
Denmark will be using those IP-numbers, which makes it look like the
Dane comes from Sweden and you your case you would server them something
in Swedish which ain't Danish. This applies for Hi3G users, sure you
could adjust and tell that those IP-numbers should get things in Danish,
but then the Swedish users will get it in Danish too.

There are quite many such ranges and some companies lets other companies
to use part of their range to thir party which may not come from the
same country.

GeoIP does have quite okey lists, but only if you are paying for it, the
free lists has loads of known issues.


Sadly you didn't answer Jerrys question, why do you want to do this,
detect the users country?

--

//Aho
Re: recognize country [message #184202 is a reply to message #184200] Sun, 15 December 2013 11:05 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
[Removed *non-existing* alt.php from the Newsgroups header field value]

nawfer wrote:

>>> GeoIP.
>>
>> Which is just as accurate as any other IP-based location service. IOW,
>> not very.
>
> but is a online service or one php array or both
> ?

Once you have learned to write an coherent question, one might be able to
help you.

Please also learn to quote. The attribution lines are relevant as a posting
replied to now can and will expire later.

> but isn't stable the ip of the nations?

No. First of all, nation and country are different subjects. A country can
have, and I daresay by now most countries do have, inhabitants from several
nations. There is also the increasingly likely possibility for a person to
have multiple nationalities.

Second, IP address ranges are allocated to *Regional* Internet Registries
(RIRs), which then allocate them for Local Internet Registries (LIRs). LIRs
include Internet service providers, enterprises, or academic institutions:

<https://en.wikipedia.org/wiki/IPv4#Allocation>
<https://en.wikipedia.org/wiki/IPv6_address#IPv6_address_space>

> example
> 50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A
> 101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B
> 151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C

This cannot be correct because several address ranges within those ranges
are reserved for special use already:

<https://en.wikipedia.org/wiki/IPv4#Special-use_addresses>

> ok the ip inner nations ip can't be accurate and can to change, but
> between nation is table (every range is assigned at only one nation)?

No. Why do you want to determine the nation/country?


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Re: recognize country [message #184203 is a reply to message #184195] Sun, 15 December 2013 12:42 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
richard <noreply(at)example(dot)com> wrote in news:461fsbu98jld(dot)1vftfxn0dl3dg(dot)dlg(at)40tude(dot)net:

> On Sat, 14 Dec 2013 14:43:34 +0100, nawfer wrote:
>
>> which code to use for send page
>> x
>> y
>> z
>> depending by user's nation?
>
> GeoIP.
> This utility reporsts the country based on user's location.

No, it does not. It reports the country based on the *presumed* location of the user's
*presumed* IP address -- which is *not* a reliable indicator of the actual location of the user.
Re: recognize country [message #184204 is a reply to message #184202] Sun, 15 December 2013 12:51 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote in
news:2197091(dot)TGfsNCzbWx(at)PointedEars(dot)de:

> [Removed *non-existing* alt.php from the Newsgroups header field value]
>
> nawfer wrote:
>
>>>> GeoIP.
>>>
>>> Which is just as accurate as any other IP-based location service. IOW,
>>> not very.
>>
>> but is a online service or one php array or both
>> ?
>
> Once you have learned to write an coherent question, one might be able to
> help you.

Halt Maul, du Esel.

Oh, *do* shut up, PointedHead, you jackass. *Obviously* English is not his first language.
And he likely figured that -- given the prevalence of English speakers in the computer
language newsgroups -- that he stood a better chance of getting a good answer to a
question posed in halting, broken English than one posed in perfect Albanian or whatever
his native language is.
Re: recognize country [message #184205 is a reply to message #184200] Sun, 15 December 2013 13:13 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <10m4kg1lqaghb$(dot)1qos4ncc1tq11$(dot)dlg(at)40tude(dot)net>, nawfer
<novalidsforspam(at)alt(dot)al> wrote:

>>> GeoIP.
>>
>> Which is just as accurate as any other IP-based location service. IOW,
>> not very.
>
> but is a online service or one php array or both
> ?
>
>
> but isn't stable the ip of the nations?
> example
> 50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A
> 101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B
> 151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C
>
> ok the ip inner nations ip can't be accurate and can to change, but between
> nation is table (every range is assigned at only one nation)?

No.

And your organisation might cover a continent or be worldwide. You
would use the same IP range for the whole network.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: recognize country [message #184206 is a reply to message #184199] Sun, 15 December 2013 13:37 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/15/2013 5:16 AM, nawfer wrote:
> Il Sat, 14 Dec 2013 08:58:30 -0500, Jerry Stuckle ha scritto:
>
>> On 12/14/2013 8:43 AM, nawfer wrote:
>>> which code to use for send page
>>> x
>>> y
>>> z
>>> depending by user's nation?
>>>
>>
>> How are you going to find the users nation? IP address is not reliable.
>>
>> Let's try a different question. What are you trying to accomplish?
>
> yes is a double question
> how find the users nation
> and after
> how send relative page
>

You can't find the user's nation automatically in any even halfway
reliable way.

But again - what are you trying to accomplish? Not how should you do
it. What's your goal here?


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: recognize country [message #184207 is a reply to message #184202] Sun, 15 December 2013 13:49 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/15/2013 6:05 AM, Thomas 'PointedEars' Lahn wrote:
> [Removed *non-existing* alt.php from the Newsgroups header field value]
>
> nawfer wrote:
>
>>>> GeoIP.
>>>
>>> Which is just as accurate as any other IP-based location service. IOW,
>>> not very.
>>
>> but is a online service or one php array or both
>> ?
>
> Once you have learned to write an coherent question, one might be able to
> help you.
>

His question is quite coherent.

> Please also learn to quote. The attribution lines are relevant as a posting
> replied to now can and will expire later.
>

Maybe a little sparse, but he is quoting properly.

<snip>


>> ok the ip inner nations ip can't be accurate and can to change, but
>> between nation is table (every range is assigned at only one nation)?
>
> No. Why do you want to determine the nation/country?
>

Now we're starting to get down to the real problem.

>
> PointedEars
>

added alt.php back in to the list, since it is appropriate to this
discussion.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: recognize country [message #184208 is a reply to message #184200] Sun, 15 December 2013 13:50 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 12/15/2013 5:34 AM, nawfer wrote:
>>> GeoIP.
>>
>> Which is just as accurate as any other IP-based location service. IOW,
>> not very.
>
> but is a online service or one php array or both
> ?
>
>
> but isn't stable the ip of the nations?
> example
> 50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A
> 101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B
> 151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C
>
> ok the ip inner nations ip can't be accurate and can to change, but between
> nation is table (every range is assigned at only one nation)?
>

No. IP addresses do not know national boundaries.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: recognize country [message #184209 is a reply to message #184200] Sun, 15 December 2013 14:22 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
nawfer, 2013-12-15 11:34:

>>> GeoIP.
>>
>> Which is just as accurate as any other IP-based location service. IOW,
>> not very.
>
> but is a online service or one php array or both
> ?
>
>
> but isn't stable the ip of the nations?
> example
> 50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A
> 101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B
> 151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C

No - it does not work that way.

> ok the ip inner nations ip can't be accurate and can to change, but between
> nation is table (every range is assigned at only one nation)?

No.

IP ranges are assigned to providers - and providers can operate in
multiple countries. And by the way - there is also IPv6.

But you still did not answer what you want to achieve.

If you want to handle different languages, you should better use the
Accept-Language header oft the browser - and even then the visitor
should be able to manually select the language, just in case the browser
does not send an Accept-Language header at all or there is no "known"
language in the list of accepted languages.

Also see: <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>

And for example - if you have content in English, French in Italian and
you want to deliver it depending on the users browser settings (yes, the
quality value of each language is ignored, since literally all browsers
send the preferred languages in the order of preference):

<?php
// This is the list of languages we support

$knownlanguages = { 'en', 'fr', 'it' };

// This is the active language in which the content
// is being served - 'en' by default

$activelanguage = 'en';

// Build an array of languages based on the Accept-Language
// header the browser sends

$languages = explode(',', preg_replace('/(;q=\d+.\d+)/i',
'', getenv('HTTP_ACCEPT_LANGUAGE')));

// Now go through the list and check if the browser
// supports any of "our" languages

foreach ($languages as $language) {
if (in_array($language, $knownlanguages)) {
// Language is known, then use this and stop
// checking the remaining entries
$activelanguage = $language;
break;
}
}

// Now $activelanguage contains one of our supported
// languages which is also accepted by the browser
?>

BTW: You can see this in action on my private site
<http://arnowelzel.de>. The code is not identical, but very similar. The
site will redirect to the English or German version depending on what
language the browsers prefers or defaults to German if no "known"
language was given. However it is always possible to change the language
using the "language" links in the header.



--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Re: recognize country [message #184210 is a reply to message #184195] Sun, 15 December 2013 15:21 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Sat, 14 Dec 2013 18:56:43 -0500, richard wrote:

> On Sat, 14 Dec 2013 14:43:34 +0100, nawfer wrote:

>> which code to use for send page x
>> y
>> z
>> depending by user's nation?

> GeoIP.
> This utility reporsts the country based on user's location.
> But why not let the user select the proper page wotj a dropdown list?

Select random from worlds ten most internet connected countries is
probably almost as accurate as IP based country determination.

(may contain some exaggeration)

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: recognize country [message #184211 is a reply to message #184200] Sun, 15 December 2013 15:35 Go to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 15/12/13 10:34, nawfer wrote:
>>> GeoIP.
>>
>> Which is just as accurate as any other IP-based location service. IOW,
>> not very.
>
> but is a online service or one php array or both
> ?
>
>
> but isn't stable the ip of the nations?
> example
> 50.xxx.xxx.xxx to 100.xxx.xxx.xxx all ip nation A
> 101.xxx.xxx.xxx to 150.xxx.xxx.xxx all ip nation B
> 151.xxx.xxx.xxx to 200.xxx.xxx.xxx all ip nation C
>
> ok the ip inner nations ip can't be accurate and can to change, but between
> nation is table (every range is assigned at only one nation)?
>
every range is assigned to many more than one nation.

Blocks down to 256 IP addresses are allocated more or less randomly
among countries.

And that's before you consider mobile devices...proxies...and NAT


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Apache HTTP Server
Next Topic: activating a JS script from PHP redirect
Goto Forum:
  

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

Current Time: Fri Dec 27 03:23:48 GMT 2024

Total time taken to generate the page: 0.04035 seconds