I am creating a system and I want to make sure that my user can only do five posts in the database, that is, in the site. What logic would I use to make this kind of permission? Thankful.
I am creating a system and I want to make sure that my user can only do five posts in the database, that is, in the site. What logic would I use to make this kind of permission? Thankful.
Make a select before opening the post field to check how many posts it has already made.
If you want to be 5 posts per day, make a date field in the database to count how many posts were made on that same date.
A simple select would solve it.
Something like this:
SELECT count(id_usuario) as contador FROM suatabela WHERE data = datadehoje
then an if with the result
if (contador >= 5) { echo 'ja atingiu o limite'; }
else { include('formdepostagem.php'); }
I think this is the logic you are looking for. If it is not, try to give more details.