IP Blacklist in PHP+MySQL
I have been trying to implement a sort of IP blacklisting in PHP, where I store failed login attempts to a MySQL table with the following schema: CREATE TABLE blacklist( `ip_address` VARCHAR(35) NOT NULL, `failures` INTEGER DEFAULT 0, `release_time` BIGINT DEFAULT -1, PRIMARY KEY(`ip_address`) ); On my login check, I first delete any blacklist entries that have a release time before the current time (if the release time has already passed) with the following query: /* I pass in time() */ DELETE FROM failures WHERE release_time < ?; I then execute the following: /* I pass in $_SERVER['REMOTE