Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Serving different pages depending on IP
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Serving different pages depending on IP

 Post Reply Post Reply Page  12>
Author
Nathan View Drop Down
Groupie
Groupie


Joined: 08 January 2002
Location: Greece
Status: Offline
Points: 160
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nathan Quote  Post ReplyReply Direct Link To This Post Topic: Serving different pages depending on IP
    Posted: 01 May 2004 at 3:26pm

I have a travel site for the Greek island of Corfu, and would like to serve the Greek text pages to Greek visitors, and English text pages to everyone else.

I think all Greek IP addresses start with 212.

 

I assume the following:

if 'IP starts with 212' then

     include Greek text

else

     include English text

end if

 

Could anyone help me code the expression - 'if IP starts with 212'

Also, does anyone know how I can find out if 212 does indeed cover all of the Greek IP address.

Thanks for any help you can offer.

Nathan

www.corfu-travel-guide.info

www.agni.gr

 

 

Back to Top
Mikael View Drop Down
Groupie
Groupie
Avatar

Joined: 16 November 2002
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mikael Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2004 at 4:27pm

I would use asp servervariables inbuild language-tool to get the users language:

If Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") = "gr" Then....

The answer of your IP-based question:

If Mid(Request.ServerVariables("REMOTE_ADDR"), 1, 3) = "212" Then

key: Mid(string,start[,length])
Back to Top
weppos View Drop Down
Groupie
Groupie


Joined: 23 May 2003
Status: Offline
Points: 173
Post Options Post Options   Thanks (0) Thanks(0)   Quote weppos Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2004 at 4:29pm
Quote Could anyone help me code the expression - 'if IP starts with 212'


You can use

If Left(Request.ServerVariables("REMOTE_ADDR"), 3) = "212" Then

    'Do something
End If


... anyway....

Quote Also, does anyone know how I can find out if 212 does indeed cover all of the Greek IP address.


...I suggest you to get client country using IP address and information provided by ip-to-country.
Follow this link

It allows you to create and query an IP database to find the right client country.
Back to Top
weppos View Drop Down
Groupie
Groupie


Joined: 23 May 2003
Status: Offline
Points: 173
Post Options Post Options   Thanks (0) Thanks(0)   Quote weppos Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2004 at 4:31pm
Originally posted by Mikael Mikael wrote:

I would use asp servervariables inbuild language-tool to get the users language:If Request.ServerVariables("HTTP_ACCEPT_LANGUAGE") = "gr" Then....




It's only quite correct.
For example I usually use Netscape or Firefox and they tell you I'm english, while I'm italian.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2004 at 5:17pm

Corfu is a beautiful place. Went there years ago after I was asked to leave Italy .

The ip number method of identifying a country is not reliable. IP addresses are not assigned by country. They are assigned by the ICANN to  Local Internet Registries (LIR's). There are 4 of them - IIRC, Europe is covered by an organization called RIPE. An LIR will assign a block of numbers to major backbone providers - e.g. British Telcom, ATT, etc. How the backbones distribute is up to them. The backbone provider for 212 could use some part of that range of numbers for Greece, some for Finland, and some for the Azores.

ISP's get their numbers from the back-bone providers - an ISP in Greece might have both British Telcom and AT&T. Part of their number ranges might start with aaa from ATT, part with yyy from BT.

What ip number an end user winds up with will also depend on the location of their isp. Many isp's have branches in different countries. AOL is the best example. Your users may have a greek isp that is a branch, or gets ip numbers from a larger isp in Germany.

If I were you however, I'd still take my best guess. I'd check for number, country code on their http_referer, amd language. If you see anything that looks like it's Greek, send them to the Greek page with an English link-out on it.

http://ip-to-country.webhosting.info/ has tools for playing around with country stuff.

EDIT - Did a quick look up. The 212 block is held by ATT. A quick whois check of some numbers - e.g. 212.1.1.1, 212.200.200.200, etc., from the RIPE data base - http://www.ripe.net/db/whois/whois.html -Turned up addresses in Great Britain, The Channel Islands, Holland, and Germany.



Edited by dpyers

Lead me not into temptation... I know the short cut, follow me.
Back to Top
Nathan View Drop Down
Groupie
Groupie


Joined: 08 January 2002
Location: Greece
Status: Offline
Points: 160
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nathan Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2004 at 3:16am

Thank you very much for such comprehensive answers and helpful advise. I will try a bit of fiddling and report back. Interestingly of course this is going to be difficult to test as I live in Greece. I'll enlist the help of some of my site members to test the system.

Thanks Again.

Nathan

Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 2004 at 2:17pm

may i ask why not just write / flags where the uer can clcik a link/image with the name of the language so it is their flags or English and greek (in greek)..

Back to Top
weppos View Drop Down
Groupie
Groupie


Joined: 23 May 2003
Status: Offline
Points: 173
Post Options Post Options   Thanks (0) Thanks(0)   Quote weppos Quote  Post ReplyReply Direct Link To This Post Posted: 04 May 2004 at 3:41pm
Originally posted by dj air dj air wrote:

may i ask why not just write / flags where the uer can clcik a link/image with the name of the language so it is their flags or English and greek (in greek)..



Sorry, I can't understand.
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.