1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can this be done with PHP

Discussion in 'PHP & Perl' started by paymymortgage4me, Jun 28, 2008.

  1. paymymortgage4me

    paymymortgage4me Junior Member

    Joined:
    Apr 5, 2008
    Messages:
    163
    Likes Received:
    308
    Location:
    I'm An Everywhere Man
    Let's pretend my website is ww w.mysitehere.com/index.php.

    When a visitor comes to that site, I want to know which state they are in. If they come from a certain state, the page loads and they get my aff. ccokie. If they don't come from that state, the page loads, but no cookie is loaded.

    Is this even possible? If it is, how can it be done?

    Thanks
     
  2. undeterminederror

    undeterminederror BANNED BANNED

    Joined:
    Mar 31, 2008
    Messages:
    630
    Likes Received:
    457
    yes, you'll have 2 pages: one with the cookie and other without cookie. you load the first page just for the state you want. search for "geo targeting". there is a wordpress plugin but i didn't tested yet.
     
  3. trophaeum

    trophaeum Senior Member

    Joined:
    Dec 21, 2007
    Messages:
    1,189
    Likes Received:
    706
    actually for this you need http://www.maxmind.com/app/region to do it, no other databases are even close enough accuracy to get what you want. once you have that its something any php programmer could whip up in an hr
     
    • Thanks Thanks x 1
  4. dbrown

    dbrown Junior Member

    Joined:
    Dec 26, 2007
    Messages:
    104
    Likes Received:
    181
    yea cloaking and use that geoip data should do it.
     
  5. barigain

    barigain Junior Member

    Joined:
    Aug 23, 2012
    Messages:
    100
    Likes Received:
    12
    There are a number of MAXMIND databases, some are free and some are commercially licensed. In part, the information in these databases comes from other public databases, such as RIPE and in part from MAXMIND's internal processing/matching.
    You can write your own tools to parse RIPE database, extract all of the fields and build your own database if you want, or you can pay someone who has already done it.
    If you are going to query their databases programatically, there are APIs on dev.maxmind.com for most languages.
    Just a word of caution - if you use the MAXMIND GeoASN database to lookup ASN from IP, the AS name will not necessarily match the ISP name associated with the given IP. (e.g. AS2856 resolves to many different organisations, incl. BT and TalkTalk). Which is why the GeoISP database is keyed off IP address ranges, rather than ASNs.
     
  6. Ste Fishkin

    Ste Fishkin Jr. VIP Jr. VIP Premium Member UnGagged Attendee

    Joined:
    May 14, 2011
    Messages:
    1,904
    Likes Received:
    9,428
    Occupation:
    Rands Sex Slave
    Location:
    England
    You could even use HTML5 to grab location

    are you giving a different cookie to each state or is there just 1 state you need to give cookies too?
     
  7. barigain

    barigain Junior Member

    Joined:
    Aug 23, 2012
    Messages:
    100
    Likes Received:
    12
    HTML5 is not so good because user should allow browser to grab geo location. Detection by IP is old but proven solution so far..
     
  8. Gogol

    Gogol Elite Member

    Joined:
    Sep 10, 2010
    Messages:
    3,117
    Likes Received:
    2,895
    Gender:
    Male
    You are 5 years late to explain how to solve the problem.