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 Please tell me if you want me to supply you with further information regarding this mater.
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.
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 ?
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!
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: