I am designing a forum and I want to be able to let users upvote certain posts and I would like to record the amount of views that each post has so that I can display them to the public. I am primarily working with mysql, php, javascript, and jQuery. Typically when a user clicks on something that I want to record in the database I use jQuery to check the data, then php to input the data in the mysql database; however, this method requires the page to reload and that is definitely not what’s happening on FB or Stackoverflow’s website. I know that you can write to the database using jQuery or javascript, but everywhere that I have read about such things they advise against it for security purposes. So how should I go about this? Also, while were already here, if anyone could advise on certain precautions that should be taken in order to safeguard against abusing the upvote system. I was planning on limiting it to registered users and having a table that saves each users upvotes so that they can’t upvote something more than once.
Share
Read up on AJAX. The only security precautions are basically just validating your input, same as you should be doing for your forms or any other input from a request.