24 hours limitation
how are you all
i am working with some function where i am providing users 24 hours after login. in 24 hours they can post once.
and if they post in first 10 hours
then they will not be able to post in next 14 hours .
and after completing their remaining 14 hours then again they get 24 hours time start for posting.
Any idea how to limitate and apply this restriction ?
i mean just
they haeve 24 hours and they can post only once in 24 hours
Record the time that they logged in.
If the current time comes after the recorded time (e.g., the user logged in at 2 p.m. on 1 January 2013; the current time is 5 p.m. on 5 August 2013), check if their most recent post was made after that time today (i.e., 2 p.m. on 5 August 2013). If so, forbid the new post.
If the current time comes before the recorded time (e.g., the user logged in at 2 p.m. on 1 January 2013; the current time is 1 p.m. on 5 August 2013), check if their most recent post was made after that time yesterday (i.e., 2 p.m. on 4 August 2013). If so, forbid the new post.
Otherwise, allow the new post.
I wonder if you actually mean sign up rather than login since a user can circumvent this system just by logging out and then logging back in to reset the login time.
sorry i dont understand your point of view
can you little elaborate it
and i am just talking about 24 hours limitations,
Mean 1 task 1 time in 24 hours
I was just responding to how you presented your requirements. If you care for an alternative solution, then it would be simpler just to check if the most recent task of the user was done in the current day (i.e., midnight to midnight). If it is, then you forbid the new task, otherwise you allow it.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)