GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Need help with maxmind geo ip php script (https://gfy.com/showthread.php?t=1069731)

mkx 05-29-2012 04:22 PM

Need help with maxmind geo ip php script
 
I am really new to php and trying to figure this out so I can get better results for whatstheirip.com. I need to convert every IP address to an IP number to use the GeoIp script from maxmind. Here is their formula to convert it:

ipnum = 16777216*w + 65536*x + 256*y + z
where
IP Address = w.x.y.z

So basically I need to convert an ip (lets use 24.24.24.24 as an example) to 4 different variables = w, x, y, z

How do I do this?

Ip address = $ip

Zoxxa 05-29-2012 04:28 PM

Sorry I am on my phone so can't give examples but you can use the explode function to accomplish this. Use the period as the delimiter, convert to array, echo each piece however you want.

http://php.net/manual/en/function.explode.php

shake 05-29-2012 04:35 PM

Quote:

Originally Posted by Zoxxa (Post 18971245)
Sorry I am on my phone so can't give examples but you can use the explode function to accomplish this. Use the period as the delimiter, convert to array, echo each piece however you want.

http://php.net/manual/en/function.explode.php

That should do it, the parts of an IP are the Octets, so you can feed each one in that way and you'll be good to go

mkx 05-29-2012 04:41 PM

cool that was easier than I thought, thanks guys


All times are GMT -7. The time now is 02:21 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123