Do any of you PHP or server guru's know how to detect a corporate IP or a VPN IP?
A thousand thanks if you do and wouldn't mind sharing! Feel free to PM as well!
You could try a geoIP database for this. Something along the lines of https://www.maxmind.com/ or http://db-ip.com/ , perhaps.
If it's being done through a corporate that's got it's own range of IP addresses, and they're actually using one of the IP addresses within that range, you may well have some luck with this approach.
Maxmind has a 'detect proxy' function that will work with known VPNs, however you won't catch all of them that way. If someone's set up a VPS as a proxy, then it'll just detect that VPS - as is so often the case, it all depends on how evasive - and how savvy - the person on the other end is.
A corporate IP is not different from any other IP, other than that the range may be listed as corporate or associated with a business in some database that you can use.
Hence, you'll probably have to use a GeoIP database as Ian suggested.
How exactly would you like to implement this? For automatic redirection? For logging?
Thanks guys!
Zeno - it is for auto redirections.
Hmmm, I think only a few GeoIP solutions offer detection of registering organisations, which is what you would need - though I'm not sure if it would be possible to sensibly redirect based on the results.
The three I know of are db-ip, Maxmind and Neustar.
If you use
Buttoned up, what are you using this for?
Using jimmymob's approach would create a bleed problem.
The first bleed rate is corporate visits: a lot of people browse at work, many people buy things, they even back out visiting flogs at work. Why would corporate users not back out for you? Are you doing adult dating? If so, how do you tell your traffic source not to charge you for those clicks? I don't think you can. I suppose blocking them might be good, but who is clicking on x-rated ads at work? I've never had to implement this to avoid reports on my x-rated FB landers... because no sane person is clicking on ads with pics of girls at work.
It must be said now, that company visits are also often in the namespace of their ISP serving them. Meaning they are not always advertised as "McDonalds" but instead "ISP-name".
The second bleed rate would be probably 3% or more, and this would encapsulate ISPs not in your list. Especially in the US, there are probably thousands of regional ISPs especially delivering cell-to-home signal. I just read on reddit about one guy setting up his own ISP to serve a particular town. Admittedly, if you work on your approach (top 50 ISPs in the country) and manually inspect the filtered visits over the first few days, you can create some other manual rules and include more of the real ISPs are vetting them.
If
So the main question for OP: do you want to filter people at work, or just filter spies/affiliates using VPNs? If the former: are you sure corporate/company visits don't back out?