jennifer2010 — 2011-12-22T12:07:52-05:00 — #1
I would like to redirect users based on the state they are in to another website address as well as exclude an IP address so they can access my site.
I have js API code from MaxMind, but I'm not sure how to do the rest:
Redirect users from PA, DE and NJ to Google.com but exclude IP address 174.343.198.99 so they can access the website even if they are in one of those states.
Redirect users from FL to Google.com, but exclude IP address 220.127.116.11 so they can access even if they are in FL.
Thank you SO MUCH!
skunkbad — 2011-12-22T14:21:17-05:00 — #2
Is there any reason why this couldn't be done in php, or another server side script? It would be a lot easier and faster. In PHP, the IP address is available as $SERVER['REMOTEADDR'], and it is very easy to get a location from an IP address using:
$ip = @FiLe_get_contents("http://automation.whatismyip.com/n09230945.asp");
All you have to do is parse what is returned and you have your state.
jennifer2010 — 2011-12-22T14:23:52-05:00 — #3
Hi - I already have a PHP script but it doesn't work good enough. The api for maxmind connects to their full database which is a lot more accurate than free services.
aussiejohn — 2011-12-22T16:55:16-05:00 — #4
Does maxmind have a PHP version of their API?
Sent from my Desire HD using Tapatalk
jennifer2010 — 2011-12-22T17:00:04-05:00 — #5
They have this: http://www.maxmind.com/app/php
But it requires you to download their free lite databases to use which is not what I want to do. I already use their "lite" free databases and they do not work right. I get about 1,000 people a month from the state I don't want that don't get redirected.