I have a database of IP ranges and I am using the code below to split the range in to individual IP addresses. This works fine until I get to 210937 records then the code stops spilitting the IP range and starts inserting 0.0.0.0.
I have tried removing some IP addresses but it still stops at the same point even though the IP address is different.
for ($ip = ip2long($ip1); $ip<=ip2long($ip2); $ip++)
{
$lip = long2ip($ip);
Any suggestions would be appreciated.
Ok so here is the full code minus db connection.
$query1 = "SELECT * FROM masteriplist";
$result = mysql_query($query1);
while($row = mysql_fetch_array($result))
{
$ipe = $row['ip_end_range'];
$ips = $row['ip_start_range'];
$ip1 = "$ips";
$ip2 = "$ipe";
for ($ip = ip2long($ip1); $ip<=ip2long($ip2); $ip++)
{
$lip = long2ip($ip);
mysql_query("INSERT INTO ip_master (ip) VALUES ('$lip')")
or die(mysql_error());
}
}
ok the debugging code returned the following
array(24) {
["id"]=> string(2) "50"
["ip_address"]=> string(12) "85.119.25.27"
["ip_start_range"]=> string(0) ""
["ip_end_range"]=> string(0) ""
...
}