Forum Moderators: coopster & phranque

Message Too Old, No Replies

Kinda mini-cloaking using perl

depends on visitors location

         

ga_ga

2:21 am on Mar 3, 2003 (gmt 0)

10+ Year Member



I'm trying to develop a perl script to show different content to visitors located in different geographical locations. Kind of like cloaking, but just for one line of text (or an image representing such), and based on variable(s) related to visitor location.

Specifically, my customer doesn't want to give his 'phone number out right across the whole 'net - he wants to display it only to UK visitors. Now I guess the adage applies here, "if you don't want to give it out, don't put t on the 'net" but, I have to look as if I'm doing something .. If it worked only to partial efficiency, in most cases, it'd go some way to making him happy.

What variables could I use? at the moment I'm using this stopgap code:
(a poor method.. shoot as many holes in it as you like):

$ENV{'REMOTE_HOST'} - in a 'weed out' mode:

$domainextension = $ENV{'REMOTE_HOST'};

$domainextension =~ tr/A-Z/a-z/;
$domainextension =~ s/.*\.//;

if ($domainextension ne 'ac'){
if ($domainextension ne 'ad'){
if ($domainextension ne 'ae'){
if ($domainextension ne 'af'){
if ($domainextension ne 'ag'){
if ($domainextension ne 'ai'){
if ($domainextension ne 'al'){
if ($domainextension ne 'am'){
.
etc etc
(rejecting most tld's except .com, .org, .co.uk, .net, etc
which could conceivably relate to a local ISP in the UK)
.
.
.
.
check IP via online service, if that passes as uk show the visitor the contact information

}}}}}}}}
else
{show a picture of donald duck or something instead}

(
'check IP' above represents...

$ENV{'REMOTE_ADDR'}

fed through an online IP --> Location translator
)

trouble is, the online IP --> Location translation service I've been using thus far allows free lookups via a form interface, but continuous automated lookups, via get and a page-chopping regex, which is the best I've come up with so far, I don't think they'd appreciate.

Anyone any ideas of variables or methods I could maybe combine and employ here that are essentially free
- for instance I notice a counter service I use seems to be able to identify a visitors local timezone - that sort of thing would come in handy. Accessible via a javascript earlier in the page than the main #include for the perl file itself?

Course, I shall donate the code to the common good if we get anywhere..

Josk

10:52 am on Mar 3, 2003 (gmt 0)

10+ Year Member



Quick way is to have a database of all IP's that originate from the UK. However, you'll also be blocking UK customers that work for US based companies, or cother companies who are based outside the UK. Eg, European...

Why not just put the phone number online and say UK callers only? To make it harder just display it UK format... eg: (0207) 123 456 rather than + 44 207 123 456. That should stop foreign callers.

But why you'd want to discourage orders like this is strange...

onlineleben

11:04 am on Mar 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



and when you put the phone number nto a little graphic, it can't be picked by anything automatic/robot/spider

ga_ga

3:18 pm on Mar 3, 2003 (gmt 0)

10+ Year Member



> Quick way is to have a database of all IP's that originate from the UK. However, you'll also be blocking UK customers that work for US based companies, or cother companies who are based outside the UK. Eg, European...

You wouldn't happen to know where such a list would be publicly available would you, if in fact it is? Understand your point about blocking some users though.. it's tricky. Accessibility ramifications.

>But why you'd want to discourage orders like this is strange...

The chap's just a one-man-band tradesman (plumber); only covers a small local area and doesn't really understand the 'net - his prime reason for commissioning the site was that he was concerned about someone 'kidnapping' 'his' domain name. Initially wanted 'one of them there internet thingies'...

So when the initial site went up & he started getting calls from the US & Australia in the dead of night, (which was happening even though the UK local angle is clearly put forward prominently in the site content) he became a little perturbed.. He wanted some kind of assurance that 'things' were being done to stop the 'weirdo callers' as he puts it...

Due to efforts so far, I've managed to target visitors so that around 80% are coming in the first place, reportedly, from the UK.. but the odd overseas visitor is still calling to see if he'll come and fix a tap in kentucky .. you get the picture. I think there are a few unfortunates with a flea in their ear :(

onlineleben.. good idea.. done it.

onlineleben

3:37 pm on Mar 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



enter something like "0900 - 1700 UK business hours" and state your current UK time next to it. Or place an appropriate link to wordtimeserver.
And maybe make it even more local by referring to local places, e.g. county, cityname / county and also using more local language (don't know if there are any terms referring to plumbing that differ in UK and US english.

ga_ga

9:09 pm on Mar 3, 2003 (gmt 0)

10+ Year Member



Good ideas.. once again.. done 'em. Thanks, let's see how it goes :)