I have a table in mysql to see the wrong accesses of a login. If there are 3 records in less than 60 minutes I want to be able to block access to the ip address that you are trying to enter. In the database I keep 2 fields: ip: varchar format hour: timestamp format
The idea is to make a query to mysql that returns all the records where the same ip has a time difference with respect to the current time that is 60 minutes.
I have no idea where to start. Looking at the mysql reference manual I see this function
mysql> SELECT TIMESTAMPDIFF(MINUTE,'2003-02-01','2003-05-01 12:05:55');
-> 128885
But I do not really know what data to put on it or if that's what I need.
How could I do it?