Welcome Guest, Not a member yet? Register   Sign In
CIDR Lookup?
#1

[eluser]Eric Brown[/eluser]
I'm trying to take a user's X-Forwarded-For header and do an IP lookup from a table of values I have for CIDR ranges. I did a search but did not find anything on this forum.

Has anyone done anything like this with CI? or can you point me to the right forum post if addressed under another topic?

Thanks. I look forward to learning and contributing as I get up to speed with this framework.
#2

[eluser]Sean Gates[/eluser]
I did this, but with a third party service. Sorry I'm not much more help.

What specific problem or error are you running into?
#3

[eluser]Eric Brown[/eluser]
Thanks for the reply. I haven't really run into a problem. It's the math and technical execution that I am uncertain of.

I have an IP database. What I can't seem to figure out how to do is, convert the user-ip into a value that can be compared against the CIDR block.

By the way, what third party did you use? Did you buy the database and script or do you connect through and API?

Thanks again.
#4

[eluser]Sean Gates[/eluser]
We used a 3rd party database and API that did the lookup for us. We were restricting our site based on non-US IP addresses because we were selling music (copyright freaks in the US ban you from selling to foreigners).

I have to go back and find out who it was, but we basically used the PHP code that they supplied to us, and it was as easy as setting up a PHP object to grab the user's IP data.

-- Sean




Theme © iAndrew 2016 - Forum software by © MyBB