I have a table that logs invalid user login attempts. Every time an invalid attempt is made, the username, user IP, user email and time/date is stored in the database.
What I'd like to do is check if within ANY 24 hour time period there has been more than X invalid attempts by the same user. However, the users can change the email, username or IP at any point. So, I need to check that anyone of these 3 fields is in common.
For example:
- User ID: 1; IP: 1.1.1.1; Email: test@test.com
- User ID: 2; IP: 1.1.1.1; Email: test2@test.com
- User ID: 1; IP: 1.1.1.2; Email: test3@test.com
- User ID: 4; IP: 1.1.1.4; Email: test@test.com
- User ID: 5; IP: 1.1.1.4; Email: test5@test.com
All of these would match as the SAME user because they share EITHER the user ID, the IP or the email. Then I need to output all user IDs, IPs and emails so I can ban any user in another table that matches these criteria.