View Single Post
Old 02-11-2012, 05:42 PM  
versa
Confirmed User
 
Industry Role:
Join Date: Jun 2011
Posts: 266
redirecting traffic by country

Hello,
Tried the following geolite MaxMind and it redirected all my traffic to the redirect URL instead of just DE traffic. I just want DE (German) traffic redirected right now and if not DE continue on.

<?php
require_once('geoip.inc');

$gi = geoip_open('GeoIP.dat', GEOIP_MEMORY_CACHE);
$country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);

$my_countries = array('de');
if (!in_array(strtolower($country), $my_countries))
{
header('Location: http://www.google.com);
}
exit;
}
?>

Got the code from here:
http://www.warriorforum.com/programm...s-country.html

Help!
(-:
versa is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook