xstevey_bx Posted October 17, 2008 Share Posted October 17, 2008 If you were to take all of the public ip addresses in the world is there a numerical way that you could split them into 1000 groups? I know you can sort them by country or whatever but thats too specific for what I want to try. I want a fairly random spread. I want people to click onto my site and depending on their ip address group be reditected to one of 1000 pages. The country they are in should be recordable but have just as equal a chance of selecting each of the 1000 pages. Thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/128873-splitting-ip-addresses-into-groups/ Share on other sites More sharing options...
.josh Posted October 17, 2008 Share Posted October 17, 2008 If the groups have no apparent link to them, why split them up in the first place? Why not just pick a random one to begin with? Or...if they have no apparent link to them, but you are wanting to have the person stay with the same "group" then why not just pick $x amount of websites (enough for 1 group) and then link them to the person? I guess you're going to have to be more specific in your intentions...also, you first say 1000 groups but later you say 1000 pages. Those are two different numbers of IP addresses, so which one is it, groups or pages? Quote Link to comment https://forums.phpfreaks.com/topic/128873-splitting-ip-addresses-into-groups/#findComment-668124 Share on other sites More sharing options...
xstevey_bx Posted October 17, 2008 Author Share Posted October 17, 2008 Im really confused myself with this too lol... When a user logs onto my website I want to record their ip address. I then want that ip address to be checked against the 1000 groups of ip address I have defined to see what one it is in. Each of those 1000 groups will be associated with a page of information. If a user logs on with an ip address of 14.16.18.20 and it is a member of group number 30 then they are able to view information specific to people signing on from that ip range. What I need to know is what are the ranges e.g. (0.0.0.0 - 0.100.0.0) that I would need to define in order to split all the public ip addresses in use just now into 1000 fairly equal groups Any clearer? :S Quote Link to comment https://forums.phpfreaks.com/topic/128873-splitting-ip-addresses-into-groups/#findComment-668231 Share on other sites More sharing options...
rhodesa Posted October 17, 2008 Share Posted October 17, 2008 but again, why predetermine groups? when you get the IP address, check to see if it's in a group already. if it's not, it's a new one, and assign it randomly to one of the 1000 groups. Quote Link to comment https://forums.phpfreaks.com/topic/128873-splitting-ip-addresses-into-groups/#findComment-668232 Share on other sites More sharing options...
ratcateme Posted October 17, 2008 Share Posted October 17, 2008 what makes them a member of group number 30 also why dont you look at the binary way that IP's work and have a kind of subnet system convert the ip to 32 bit binary then the first 22 are the counts for your groups and the last 10 are the ips in each group or is that just to confusing lol Scott. Quote Link to comment https://forums.phpfreaks.com/topic/128873-splitting-ip-addresses-into-groups/#findComment-668234 Share on other sites More sharing options...
xstevey_bx Posted October 18, 2008 Author Share Posted October 18, 2008 but again, why predetermine groups? when you get the IP address, check to see if it's in a group already. if it's not, it's a new one, and assign it randomly to one of the 1000 groups. If I assigned people to a group randomly it reduces the chance of having an unbalanced spread of users between the groups. If I have the groups pre determined then areas with a high number of ip addresses in use for the one range will begin to fill up and that information will be more readily avaliable to users. However, if users in an area with an ip range that has minimal traffic then the information will become harder to view... Quote Link to comment https://forums.phpfreaks.com/topic/128873-splitting-ip-addresses-into-groups/#findComment-668602 Share on other sites More sharing options...
rhodesa Posted October 18, 2008 Share Posted October 18, 2008 without the purpose of this project, it's hard to determine the proper solution. ...if you want to predetermine groups though, here is some info that might help you out: -technically, ip addresses go from 0.0.0.0 to 255.255.255.255 -255 x 255 x 255 x 255 = 4,228,250,625 possible addresses if you crunch the numbers, it works out ABOUT like so: Group 1: 0.0.0.0 to 0.64.255.255 Group 2: 0.65.0.0 to 0.129.255.255 Group 3: 0.130.0.0 to 0.194.255.255 Group 4: 0.195.0.0 to 1.4.255.255 Group 5: 1.5.0.0 to 1.69.255.255 etc Quote Link to comment https://forums.phpfreaks.com/topic/128873-splitting-ip-addresses-into-groups/#findComment-668645 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.