doddsey_65 Posted October 4, 2010 Share Posted October 4, 2010 Hi, i am wanting to implement a post restriction on the forum im building where a new user can only post 10 posts per day and create 2 topics per day. I have thought about the process but have become stuck. I am fine for checking if they have reached their post count for the day(just a simple +1 to the table when they post then query it before posting) but how would i reset the counter after the day is up? i have also done the bit that defines how long ago they registered. So if a user registered less than 1 week ago they are only permitted 10 posts and 2 topics per day. After the day ends they can post 10 more posts and 2 more topics(numbers are examples only). Then when they pass 1 week registered they can do anything. I just dont know how to reset the counter at the end of the day. This is my example code so far: $timeslot = (strtotime("-1 week")); $reg_date = (strtotime($posts_info->user_regdate)); if ($reg_date <= $timeslot) { THEY CAN DO ANYTHING } else { if $todays_post_count == 10) { THEY CANT POST } else { THEY CAN POST } Link to comment https://forums.phpfreaks.com/topic/215106-forum-post-limitations/ Share on other sites More sharing options...
Mchl Posted October 4, 2010 Share Posted October 4, 2010 I assume you store the date and time of each post on your forum. When user tries to submit a new post check the date of latest post by this user, and if it's not CURDATE(), reset your counter. Link to comment https://forums.phpfreaks.com/topic/215106-forum-post-limitations/#findComment-1118824 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.