What I want to do is that each user gets 1 point every minute. Now I have php code in addpoints.php and then I tried myself with jQuery javascript:
function addpoints() { var userid = document.getElementById('user_id_points'); var postFile = 'addpoints.php?userid='+ userid.value; $.post(postFile, function(data){ $("#points").html(data); setTimeout(addpoints, 60000); }); }
This works very well and gives a point every 1 minute. BUT one problem is that if you just refresh the page that the script is on, then you get the point .. so you most likely just refresh the page a few times, and then you raise your points.
I was thinking about maybe in addpoints.php do if if (), which checks that the last date is more than 1 minute, and then throw an else else error.
I am just wondering if there is any better idea / thing to prevent a little problem?
Karem source share