I have a forum with lots of buttons <button class="vote" data-id="10">Vote up</button>
the data-id relates to my thread id of MySQL
table.
It can happen as a bot will automatically run the below js and send post request with several random data-id overloading the server. How can I prevent this?
//on click vote
$.post('vote. Php', {
data-id : data-id
}
Php
$userid=$_SESSION['userid'] ;
//take data-id and insert into mysql