|
|
|
Re: recognize country [message #184183 is a reply to message #184180] |
Sat, 14 December 2013 15:32   |
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
|
|
|
|
|
Cross-Posting (was: recognize country) [message #184186 is a reply to message #184185] |
Sat, 14 December 2013 20:57   |
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   |
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   |
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   |
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   |
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   |
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 #184197 is a reply to message #184194] |
Sun, 15 December 2013 00:13   |
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 #184201 is a reply to message #184200] |
Sun, 15 December 2013 10:59   |
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   |
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 #184209 is a reply to message #184200] |
Sun, 15 December 2013 14:22   |
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 #184211 is a reply to message #184200] |
Sun, 15 December 2013 15:35  |
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.
|
|
|