Can this be done with PHP

paymymortgage4me

Junior Member
Joined
Apr 5, 2008
Messages
163
Reaction score
310
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
 
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.
 
yea cloaking and use that geoip data should do it.
 
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.
 
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?
 
HTML5 is not so good because user should allow browser to grab geo location. Detection by IP is old but proven solution so far..
 
You are 5 years late to explain how to solve the problem.
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.
 
Back
Top