[Tutorial] How to Set Up Your Own GeoTargeting Script

Found this info on your site while googling. Shook my head when i saw it was here also.
I should have checked here first.
Great thread and tutorial. Easy to understand and implement.
One thing i was wondering.
How hard would it be to pull the google map based on the lattitude and longtiude and having that echo the result??
 
I have read this tutorial on crazyFix website and posted comment, which i will repost here:

Great tutorial, thanks.
One question, how i can implement javascript ads code in php echo, because i want to show different ads for different user locations?

Thanks, all the best,
Igor

Code:
<?php
                                           //connect to db
$con = mysql_connect('localhost', 'sdfsfsdfr', 'sdfsdf') or die(mysql_error());


mysql_select_db('esdfsfza', $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'];


if ( $CountryCode == RS || $CountryCode == HR ) {
    echo " <script type="text/javascript">ADSADAADS</script>";
} else {
    echo "You're outside the United States, do you like the way the US Flag looks?";
}


?>

Tried, but sure, doesn't work.

Waiting for reply.

Thanks again.
 
This is very, very helpful. I can't thank you enough. Truly, you're a genius!
 
Back
Top