-
- CommentAuthor5corners
- CommentTimeAug 21st 2008
Hi folks,
Here's one for the group. A client has asked about having certain pages (product prices) that are only viewable by people outside the country.
I was puzzled at the same time as curious as to whether this is possible.
Any suggestions?
Thanks...TERRY -
- CommentAuthorSeanPollock
- CommentTimeAug 21st 2008
I don't know how to implement it however I am 100% sure it is possible. Many video streaming sites use that so only a certain country (usually the US) can view a video. Do some googling and you'll turn up something. -
-
CommentAuthorgreg
- CommentTimeAug 21st 2008
there are a bunch of 'ip to country' services out there - there's even a free database you can download. i can't remember the name of it, but google should be able to help you.
using some sort of database like this, you can automatically determine what country a user is from. then you could have a basic setup like:
if ($country == 'whatever') echo 'you\'re not cool enough to view this';
else echo 'you\'re cool, because you\'re from a different country!'; -
-
- CommentAuthorRob
- CommentTimeAug 21st 2008
http://software77.net/cgi-bin/ip-country/geo-ip.pl
Download that as a csv and then import it into your sql database, then you can match the users IP address to the database each time they visit.
You'll need to keep it up to date though, I let mine go 6 months out and started getting loads of emails complaining that people in America could only buy in Euro's and Pounds etc etc -
-
CommentAuthorgnome
- CommentTimeAug 22nd 2008
I know someone here just did that a couple of weeks ago. It may have been Johan. -
-
- CommentAuthorniemion
- CommentTimeAug 23rd 2008
Hi Terry. Gnome is right, I did this recently.
You'll need the database from http://www.maxmind.com/app/geolitecountry.
It's a bit tricky to get the database imported into MySQL if that is what you need, but following this guide will take you there.
Based on that free database you can check out your country here.
If you need any help just post here again. -
- CommentAuthorniemion
- CommentTimeAug 26th 2008 edited by niemion on the 26th August 2008 at 10:56:42 EDT
Did that help you? You can also use the hostname. It's faster but there are a few things you have to consider. I've written a script to redirect user with specific hostnames, shoot me an email if you want to try it out.
1 to 7 of 7
