GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   Geo redirect code (https://gfy.com/showthread.php?t=1168737)

Freedoom 06-19-2015 03:47 PM

Geo redirect code
 
Hi,

I have this code to redirect traffic :

Code:

<?PHP
include('/home/domain/public_html/geoip/geoip.inc'); //this file must exist in your directory
 
$gi = geoip_open('/home/domain/public_html/geoip/GeoIP.dat',GEOIP_STANDARD);
 
// get the ip of the visitor
$addr = getenv('REMOTE_ADDR');
// translate his ip to a country code
$country = geoip_country_code_by_addr($gi, $addr);
// close the geo database
geoip_close($gi);
 
$badcountry = array('TR','IN','ID',"PK","CN",'MY');
// You can change the example with any countries that you want to block
 
// redirect them if they suck
if(in_array($country, $badcountry))
header('Location: http://www.domain.com/'); //enter a url or page on your site
?>

How can I redirect the "good" traffic(all the countries that aren't in the bad country array) to other url?

Thanks

CPA-Rush 06-20-2015 08:23 AM

header('Location: http://bye.com');
}
else
{
header('Location: http://welcome.com');
}
?>


All times are GMT -7. The time now is 10:02 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc