Home > Programming, Servers & Scripts > Hosting, Servers & Security

switch hosting, now geo-redirect doesnt work (3)


08-03-2011 08:02 PM #1 jamesruhles (Member)
switch hosting, now geo-redirect doesnt work

switched over to beyond hosting, and now my geo-redirection script doesnt work.

this is the script I WAS using

[PHP]<?php

if(isset($_SERVER['REMOTE_ADDR'])) {
include_once('geoip/geoip.inc');
$gi = geoip_open('geoip/GeoIP.dat',GEOIP_STANDARD);
$country = geoip_country_code_by_addr($gi,$_SERVER['REMOTE_ADDR']);
geoip_close($gi);
}else {
$country = '';
}

if($country=='US') {
header('Location: http://www.USofferHere.com/');
}else {
header('Location: http://www.internationalOfferHere.com/');
}

?>[/PHP]

with maxminds geoip.dat and geoip.inc files in the same folder. It worked perfectly fine until I switched hosting. This is the error I get:

"Fatal error: Cannot redeclare geoip_country_code_by_name() in /geoip/geoip.inc on line 346"

anybody have any idea what I can do? Facebook reviewers have been disapproving all my ads lately cause they are too lazy to look at it from the country that I am advertising it ins ip address


08-03-2011 08:13 PM #2 abcd (AMC Alumnus)

- Open the geoip.inc file
- Search for the geoip_country_code_by_name function
- Put this function between the following code:

if (!function_exists('geoip_country_code_by_name')) {
// ORIGINAL FUNCTION HERE
}


08-04-2011 12:55 AM #3 BeyondHosting-Tyler (Member)

We have the geoip module loaded on our servers, I think the geoip.inc file your loading is trying to load the module again under your suexec env. I remember a ticket about this recently, may have been you, may not.

Anyway, if you didn't get it working bump a ticket we will take care of ya!


Home > Programming, Servers & Scripts > Hosting, Servers & Security