Anyone know how to create a geo-targeted banner?

Discussion in 'Programming' started by sfraise, Mar 4, 2009.

  1. #1
    I've been trying to see exactly how to create a geo-targeted banner which will display a city name based on the visitors Ip similar to the adult friend finder ads you see all the time.

    Unfortunately I can't find any information on how this is done.

    Anyone have any idea how to do it, or a site that tells how to do it?
     
    sfraise, Mar 4, 2009 IP
  2. fable

    fable Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need a big data base with all ip's info, in some sites you can download it but the most is incomplete, here you can find free samples http://www.ip2location.com/developers.aspx or you can buy the complete database then only you have to make your script and that's all.

    I have a database but only has countries codes and countries names.
     
    fable, Mar 4, 2009 IP
  3. sfraise

    sfraise Peon

    Messages:
    453
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, but you can use the maxmind database for free, I really just need to figure out how to compile a script.
     
    sfraise, Mar 4, 2009 IP
  4. alexpr07

    alexpr07 Active Member

    Messages:
    284
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #4
    The script is easy as long as you have the right database. First you need to convert the IP address (ex. 201.20.145.10) to a number (ex. 123430494) and then just lookup that number in your database.

    For example, your database should contain the following fields:
    From, To, Country, State, City

    So the query would be "SELECT city FROM <database name> WHERE from <= <converted ip address> AND to >= <converted ip address>

    This query will return you the city for the visitor's IP.

    If you have such database, I can provide you with ASP script. I'm not so familiar with PHP but probably could do that as well.
     
    alexpr07, Mar 4, 2009 IP
  5. sfraise

    sfraise Peon

    Messages:
    453
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks alexpr07, what I really want to do is use the free maxmind ip database that the script would draw from. The script would pull the city and state of the visitor based on ip and would have text at the top saying something like "Meet people in (city, state), then use a few photos of people, and under it show the city and state based on the visitors IP. Or would show a static image as a banner and then pull the city and state based on IP and place it somewhere in the banner.

    Basically if you go to adultfriendfinder.com you can see what I mean.
     
    sfraise, Mar 4, 2009 IP
  6. alexpr07

    alexpr07 Active Member

    Messages:
    284
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #6
    Where can I take a look at this maxmind database? what fields and values does it have?
     
    alexpr07, Mar 5, 2009 IP