Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8047995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:17:19+00:00 2026-06-05T06:17:19+00:00

Help! I’m writing some code to update a mySQL database using similar to the

  • 0

Help! I’m writing some code to update a mySQL database using similar to the code below:-

$.post('http://myURL.com/vote.php?personID=' + personID + '&eventID=123');

The vote.php code takes the querystring values and inserts a record into a database with those values in it.

This kind of code is working fine, but I’ve realised the problem is that people could just type something like:

http://myURL.com/vote.php?personID=5&eventID=123

into their address bar and essentially spam the app…

Is there a straightforward way I can ensure this doesn’t happen? I’m reasonably new to these technologies so not aware of how everything works or fits together, but I’m learning fast so any pointers would be super useful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:17:20+00:00Added an answer on June 5, 2026 at 6:17 am

    It is not a good idea to use GET parameters for data that goes to a database. Generally, you want to use POST parameters which are not visible in the URL. So instead of :

    $.post('http://myURL.com/vote.php?personID=' + personID + '&eventID=123');
    

    You would do it like this :

    $.post('http://myURL.com/vote.php', { "personID" : personID, "eventID" : 123 });
    

    And in your PHP script, you would access your data with the $_POST array like this :

    $personID = $_POST['personID'];
    $eventID = $_POST['eventID'];
    

    However, don’t forget to properly filter input before saving to the database to prevent bad things like SQL Injection.

    This is not a silver bullet : spam will still be possible because any HTTP client will be able to send a post request to your site. Another thing you can look at is Security Tokens to make it even less vulnerable to spam. Or implement a system that limits the number of request/minute/user… but I’m getting too far from the original question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Help to understand why the third step (update status) fails: request_token (OK): GET:https://graph.facebook.com/oauth/authorize? client_id=XXX&
Help, if you can- The situation: http://foobar.com includes a remotely hosted javacript file (
Help I'm very new with web developing using ASP.NET. Why is the my web
Help! I'm using the ASP.Net Login control on a Login page, but the Login
Help, I'm trying to create a new post in my wordpress blog with custom
Help with regular expressions needed. I'm trying using regular expressions and preg_match_all find blocks
Help, Im really sick of using this lots of nbsps in my results page.
Help for this specific server side php code I don't have any knowledge of
Help me with this part of code: class Ooo attr_accessor :class_array end def func(ctx)
Help creating WCF for Windows Phone I need some massive help in being pointed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.