Blocking users activity for 24/48 hours

Discussion in 'PHP' started by Jeehan, May 15, 2010.

  1. #1
    The script will act this way,

    a user will come to the page,
    clicks on a button,
    it will show certain text,
    then the page will be blocked for 24hours for that user and will say "you can do it again after 24 hours".
    the user will be able to access the page after 24 hours passes.


    Please help me out with it. Not asking for complete thing, asking help for guidance.

    Thank you very much.
     
    Jeehan, May 15, 2010 IP
  2. kaleshwar

    kaleshwar Peon

    Messages:
    43
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do the users have a username? if so just put the username along with the time they saw the text into a database, you can either format it according to db timestamp format or just use the output from php's time() function and store that as BIGINT or such, then you can just check the db to see the amount of time passed, and act accordingly. then you can update the db again when they click button again, and if not using a username or such you will need to do the above using either cookies or ip address in place of username.
     
    kaleshwar, May 16, 2010 IP
  3. Jeehan

    Jeehan Well-Known Member

    Messages:
    1,578
    Likes Received:
    31
    Best Answers:
    1
    Trophy Points:
    115
    #3
    thank you for the reply, yes i have username and a database.
     
    Jeehan, May 16, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #4
    Log the username + time, then whenever the button is clicked check if the time (last logged), is after 24 hours...proceed else...error.
     
    danx10, May 16, 2010 IP
  5. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Just catch the IP, Username and Hour i.e time and store them and compute an function such that it can allow to login in a difference of prescribed hours! :)
     
    roopajyothi, May 16, 2010 IP