in reply to blocking last ip octet
Store this in your database as a 32-bit integer, which is much more eficient than an 18-byte character field for IP address.my @octets=split(/\./,$ip_address); my $numerical_address=($octets[3]+(255*$octets[2])+(65535*$octets[1])+ +(16777216*$octets[0]));
Any result greater than 0 is a hit.SELECT count(*) from table WHERE (int(ip/256)*256) = (int($ip_address_ +to_be_compared_to/256)*256)
|
|---|