I’m not used to work with values that should decrement every a timelapse like for a user warned, for example a warn which persist for 30 days that can reach a maximum value of 3 warns before the user get banned
I thought to design a user table like this but now I should work on it, I find it not useful on decrementing the values every 30 days:
table_user
- username
- email
- warnings (integer)
- last_warn (timestamp data type)
should I use some php timer?
does exist any standard tecnique on user warnings?
Normalize your tables, by breaking out the warnings from the user, like:
you can now write a query to determine if there are three warning in the last 30 days. Run this query when a “warn” happens, and if a row is returned, ban the user.
The query would look something like this:
By making a warning table, you can keep a complete warning history, which may be useful.