Hey Forum, I am building a site that I only would like USA members to join. Is there a script that will detect the visitors location and redirect them if they are not from USA? I have seen one used by cpastorm and would like to use something similar. Thanks, Mike
I will be making the site PHP. I will also need this script to detect proxies and not allow proxies on the site. I don't think GeoIP does this or am I wrong?
How soon do you want something sorted, I am a bit jammed coding stuff for a few other people, but could probably do something for you if you want. I wouldn't charge but donations are always appreciated - feel free to drop me a PM if you want to give me the details Cheers Ry
In fact, here is something thats rough and ready. It should check if proxy is used and give you the true IP address and the country shortcode (US / UK / DE etc) Hope it helps - if you have probs, PM away. <?php if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip=$_SERVER['HTTP_CLIENT_IP']; // This visitor is using a proxy, this should be the true IP - so do what you have to to deny proxy user } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; // This visitor is using a proxy, this should be the true IP - so do what you have to to deny proxy user } else { $ip=$_SERVER['REMOTE_ADDR']; // This is the proper IP address, not a proxied one so } $country = file_get_contents('http://api.hostip.info/country.php?ip='.$ip); print "IP = $ip<br>Country = $country<br>"; ?> Code (markup):