PHP Masters i beg for help !!

Discussion in 'PHP' started by xkaser101, Sep 8, 2010.

  1. #1
    I have been searching all over the net for this but i can't find the right thing so i decided to create my own Topic,
    What i am trying to get is a basic script that rewards a registered user on mysql database once they click on a link I.E ( I created a scrach & win points game , and when they win lets say 5 points i want to click on the link then go to that reward page and give them for example 5 points. but i want them to be able to use this once every 24 hours ! ) please help me :(
    I am kinda lost :confused:
    Please tell me if you want me to supply you with further information regarding this mater.
     
    xkaser101, Sep 8, 2010 IP
  2. Michellu

    Michellu Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not really sure if i understand where the problem is. Basically you can do it like this: you need a database where you can record the user you give the points to, and the date and time of this operation. Every time the user clicks the link you check in the database and only grant him the credits if at least 24 hours have passed since he last received points. Also you update the date and time of the operation with the current date and time.
     
    Michellu, Sep 8, 2010 IP
  3. xkaser101

    xkaser101 Peon

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Great, i already have a database withh 5000+ registered user, and i already have a points field but want them to click on that link and add some points + they can do that once every 24 hours, is that possible ? if yes can you hook me up with a code ?:rolleyes:
     
    xkaser101, Sep 8, 2010 IP
  4. Eager2Seo

    Eager2Seo Member

    Messages:
    72
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #4
    does each user have a unique id?
     
    Eager2Seo, Sep 8, 2010 IP
  5. xkaser101

    xkaser101 Peon

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes, each one has a uniqe id.
     
    xkaser101, Sep 8, 2010 IP
  6. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #6
    You can use timestamp
     
    guardian999, Sep 8, 2010 IP
  7. xkaser101

    xkaser101 Peon

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I see =) too bad i am still learning if anyone can hook me up with a basic code
     
    xkaser101, Sep 8, 2010 IP
  8. Eager2Seo

    Eager2Seo Member

    Messages:
    72
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #8
    Lots of ways to skin this cat, you can create a timestamp field in the main table, check for a 24 hr time difference to do whatever you want(select statement/then compare times). You can also create another relational table that records EVERY time or The latest time a user cracks in, and if there is a 24 hr time difference on the latest record give permission....

    Maybe tell them come back in 8 hrs and 4 min...you get the idea?

    If you need the script I would do it in exchange for exactly how you are going about your technique!
     
    Eager2Seo, Sep 8, 2010 IP
  9. lowridertj

    lowridertj Well-Known Member

    Messages:
    2,882
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    195
    #9
    Have your script do the following.

    
    
    <?php
    
    $time = time();
    
    if($win & $user['last_given'] <= $time-86400){
    //mysql_query here to give the user the 5 points and update time given the points..
    echo "<a  href=link-to-page.php>Click here to redeem your points</a>";
    }
    
    ?>
    
    
    
    PHP:
     
    lowridertj, Sep 8, 2010 IP
  10. xkaser101

    xkaser101 Peon

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    thank you i think i can start from there.
     
    xkaser101, Sep 9, 2010 IP