Click to See Complete Forum and Search --> : Country redirection


tims15
11-04-2005, 04:00 PM
Sorry if this is in the wrong forum, but I didn't know where is should go.

I want to have a site which sells the same product, but with prices displayed in £s for english users and $ for american. What is the easiest way of only showing the right page for the user automatically? Some sort of redirect based on location?

Fang
11-05-2005, 08:43 AM
Find the users location by getting their IP address, converting to IP number and use a look-up table to obtain the country code.
Convert IP address to number (PHP):
$ip_number = ip2long($_SERVER['PHP_SELF']);
Download the IP-country database (http://www.gold-software.com/download6589.html). Write a program that searches the database for the number and returns the country code.

chestertb
11-06-2005, 06:53 AM
Find the users location by getting their IP address, converting to IP number and use a look-up table to obtain the country code.

...except that sometimes the user's IP address doesn't neccessarily reflect the location of the user. You'll get it right most of the time, but make sure you have an option to allow your visitors to choose their currency manually.
CTB

tims15
11-08-2005, 11:38 AM
Cheers for you help, you've given me a good idea what to do ;)