I am making a game with PHP and jQuery, but I have some problems with security. It's a typing game, and when player types combination correctly, jQuery sends ajax request to PHP and PHP adds 10 points to session. Here is my code:
$('body').on('keyup','.codes_input',function() {
if($('.codes_input').val() == $('.code').html()) {
$.post(url+'/save_results',{_token:token});
points=points+10;
$('.code').html(randomString());
$('.codes_input').val('');
$('.points').html(points);
}
});
However, my friends could simply do many such $.post(url+'/save_results',{_token:token});requests in chrome extention (if I understood correctly) and got 1000 or even more points (cheating). Is there a way to avoid this? I can't find other way of programming this... Thanks for your help, sorry for my poor english :)