![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
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! (-: |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Aug 2011
Location: Las Vegas
Posts: 1,086
|
Change
if (!in_array(strtolower($country), $my_countries)) to if (in_array(strtolower($country), $my_countries)) remove the '!' |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Jun 2011
Posts: 266
|
That did it, many thanks!
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Aug 2011
Location: Las Vegas
Posts: 1,086
|
Sure, I had the exact same problem before.
![]() |
![]() |
![]() ![]() ![]() ![]() |