Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 05-29-2012, 04:22 PM   #1
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
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
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-29-2012, 04:28 PM   #2
Zoxxa
Confirmed User
 
Zoxxa's Avatar
 
Industry Role:
Join Date: Feb 2011
Location: Ontario, Canada
Posts: 1,026
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
Zoxxa is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-29-2012, 04:35 PM   #3
shake
frc
 
Industry Role:
Join Date: Jul 2003
Location: Bitcoin wallet
Posts: 4,663
Quote:
Originally Posted by Zoxxa View Post
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
shake is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-29-2012, 04:41 PM   #4
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
cool that was easier than I thought, thanks guys
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.