I\'m trying to implement an IP banning system into my web app using MySQL, i know i can do it using .htaccess
but that\'s not neat to me.
Basically my curre
This is trickier if you want to ban subnets
Notes:
So:
Then the WHERE clause becomes
WHERE ip = @ip --whole IP
OR
(ip & mask = @ip) --subnet
If you make the mask 0xffffffff
for exact IP addresses then you can always do ip & mask = @ip
, with ip & mask
as a computed column
Also, you have IPv6 to think of too