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

  • Home
  • SEARCH
  • 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 8133197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:32:08+00:00 2026-06-06T09:32:08+00:00

Getting this out of the way; I don’t frequently do much in php or

  • 0

Getting this out of the way; I don’t frequently do much in php or database programming, so I’m just trying to be extra careful in this current project.

So basically, I have a site powered by a database and I have some Jquery code that uses the “post” method to insert rows into the database. As soon as I started I had my thoughts about security, seeing as people can’t see my php, but can see my Javascript. As soon as I finished setting up the system I did a test and running the jquery does insert information even if I’m on a remote source… which can obviously lead to a possible major security problem. So being as unrefined as I am, I just want to know how I should prevent this and secure the system better?

And… Please don’t insult me or be rude… I understand that I may be stupid or whatever, but I’m just trying to learn!

  • 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-06T09:32:10+00:00Added an answer on June 6, 2026 at 9:32 am

    This is what Cross Site Request Forgery (CSRF) and the same origin policy sandbox are designed to prevent.

    From another point of view, how do you stop someone from writing a form on their site and submitting it as a POST request to your script to add junk records?

    Typically CSRF protection is provided by your framework. If you want to implement it directly in PHP, it is quite simple.

    1. Generate a unique token that from your server’s code, and add it to the session.
    2. Embed it as a hidden field in the form.
    3. On the script that accepts the form, check for the presence of this hidden field.

    If the field exists, match it against what is in the session, if they match – then it is a legitimate request.

    If they don’t match (or the field is missing), then its a remote request and you can reject it.

    This page provides some PHP code to implement the above.

    Once you have done that, you need to make sure that the jquery script can be authenticated the same way. This snippet details steps to implement the same technique in jquery.

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

Sidebar

Related Questions

I'm trying to figure out the best way to do this, but I'm getting
I just started getting this error today, seemingly out of nowhere. Any one see
I have been trying to figure out why I am getting this problem and
Ok, so I've been trying to figure out why I keep getting this specific
I am trying to figure out a way of getting Sikuli's image recognition to
I'm trying to figure out the best way to do this in jquery. I'm
I am trying to get this to echo out from the database and I
Out of the blue today I started getting this error in Visual Studio 2008
I'm getting this error when I submit my form and cannot figure out why
I'm having a problem with getting this code to print out to file due

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.