24 hours limitation
Results 1 to 5 of 5

Thread: 24 hours limitation

  1. #1
    Senior Member
    Join Date
    Mar 2010
    Posts
    141

    24 hours limitation

    Hi guyz
    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.
    For example
    they have
    24 hours
    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 ?

  2. #2
    Senior Member
    Join Date
    Mar 2010
    Posts
    141
    i mean just
    they haeve 24 hours and they can post only once in 24 hours

  3. #3
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,459
    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.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  4. #4
    Senior Member
    Join Date
    Mar 2010
    Posts
    141
    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

  5. #5
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,459
    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.
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •