Code:<?php //connect to db $con = mysql_connect('localhost', '[COLOR=Red]YOUR DATABASE USERNAME HERE[/COLOR]', '[COLOR=red]YOUR DATABASE PASSWORD HERE[/COLOR]') or die(mysql_error()); mysql_select_db('[COLOR=red]YOUR DATABASE NAME HERE[/COLOR]', $con); //Get the parameters if ($_GET["ip"]){ $ip = mysql_real_escape_string(trim($_GET["ip"]), $con); } else { $ip = getenv('REMOTE_ADDR'); } //Run the IP location query $ipQuery = mysql_query("SELECT * FROM `ip_group_city` where `ip_start` <= INET_ATON('$ip') order by ip_start desc limit 1;", $con); $ipData = mysql_fetch_array($ipQuery); $nbResults = (bool)mysql_num_rows($ipQuery); $CountryCode = $ipData['country_code']; [COLOR=red]if ($CountryCode == 'US'){header('Location: http://www.flags.net/UNST.htm');} else if ($CountryCode =='DE'){header('Location: http://www.flags.net/GERM.htm');} else if ($CountryCode =='CA'){header('Location: http://www.flags.net/CANA.htm');} else {header('Location: http://blackhatworld.com');}[/COLOR] ?>
<?php
//connect to db
$con = mysql_connect('localhost', 'dbusername', 'password') or die(mysql_error());
mysql_select_db('dbname', $con);
//Get the parameters
if ($_GET["ip"]){
$ip = mysql_real_escape_string(trim($_GET["ip"]), $con);
} else {
$ip = getenv('REMOTE_ADDR');
}
//Run the IP location query
$ipQuery = mysql_query("SELECT * FROM `ip_group_city` where `ip_start` <= INET_ATON('$ip') order by ip_start desc limit 1;", $con);
$ipData = mysql_fetch_array($ipQuery);
$nbResults = (bool)mysql_num_rows($ipQuery);
$CountryCode = $ipData['country_code'];
$urlsireland = array('www.ebay.com',
'www.amazon.com',
'www.yahoo.com');
$url = $urlsireland[array_rand($urlsireland)];
if ($CountryCode == 'US'){header('Location: http://www.flags.net/UNST.htm');}
else if ($CountryCode =='DE'){header('Location: http://www.flags.net/GERM.htm');}
else if ($CountryCode =='IE'){header('Location: http://$url');}
else if ($CountryCode =='CA'){header('Location: http://www.flags.net/CANA.htm');}
else {header('Location: http://blackhatworld.com');}
?>
http://www.blackhatworld.com/blackhat-seo/black-hat-seo/268255-cpa-redirector-2-1-modded-geoip-variable-passing-url-rotation.html
<?php
//connect to db
$con = mysql_connect('localhost', 'dbusername', 'password') or die(mysql_error());
mysql_select_db('dmname', $con);
//Get the parameters
if ($_GET["ip"]){
$ip = mysql_real_escape_string(trim($_GET["ip"]), $con);
} else {
$ip = getenv('REMOTE_ADDR');
}
//Run the IP location query
$ipQuery = mysql_query("SELECT * FROM `ip_group_city` where `ip_start` <= INET_ATON('$ip') order by ip_start desc limit 1;", $con);
$ipData = mysql_fetch_array($ipQuery);
$nbResults = (bool)mysql_num_rows($ipQuery);
$CountryCode = $ipData['country_code'];
//Rotator Code
if ($CountryCode == US)
{
$input = array("http://www.flags.net/UNST.htm",
"http://www.url2.com",
"http://www.url3.com");
}
else if ($CountryCode == CA)
{
$input = array("http://www.flags.net/CANA.htm",
"http://www.url2.com",
"http://www.url3.com");
}
else if ($CountryCode == GB)
{
$input = array("http://www.flags.net/UNKG.htm",
"http://www.url2.com",
"http://www.url3.com");
}
else if ($CountryCode == NZ)
{
$input = array("http://www.flags.net/NWZE.htm",
"http://www.url2.com",
"http://www.url3.com");
}
else if ($CountryCode == AU)
{
$input = array("http://www.flags.net/ASTL.htm",
"http://www.url2.com",
"http://www.url3.com");
}
else if ($CountryCode == IE)
{
$input = array("http://www.flags.net/IREL.htm",
"http://www.url2.com",
"http://www.url3.com");
}
else {
$input = array("http://www.blackhatworld.com");
}
$rand_keys = array_rand($input, 1);
$link = $input[$rand_keys] ;
header("Location: $link");
//
?>
Someone already asked this question and it wasn't answered. How do I use this script to display the city name to the visitor of a site.
Simple html landing page with text "Attention [city name] residents.. blah blah blah."
<?php
echo("Attention " . $City . " residents.");
?>