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 3940270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:23:54+00:00 2026-05-20T00:23:54+00:00

I would like to know the ways I could add more security to the

  • 0

I would like to know the ways I could add more security to the forms so that I could prevent attacks. From the past few days of searching in the web, and the methodology I could adopt, I’ve found a number of solutions for which I would like to know your take before proceeding.

  1. Is it always good to have include Form keys to prevent XSS (Cross-site scripting) and Cross-site request forgery?

  2. Which is the best way to process the form data:

    1. AJAX
    2. Place the form processing code on top of the same page and process it using $_SERVER[‘PHP_SELF’]
    3. Set the action of the form to another page and process all the value from there.
    4. Process the form value through a single PHP Class file.
  3. Which is the best way I could filter or sanitize the form data?

Thank you

  • 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-05-20T00:23:54+00:00Added an answer on May 20, 2026 at 12:23 am

    Here is my normal set. I use a custom framework, basically.

    I setup models that handle specific data. For example, if I have an employee form that creates new employees. I have an employee model. The model has specified values that it requires in order to generate a new employee in the database. If any values are missing in this model, when I try to save it, it will throw an exception. This is my second layer of “input validation”. The first layer is a simple java script form validator, to make sure any values aren’t missing.

    Now, for any sort of input to the page(GET, POST), I have a class that handles these sanitation. It iterates over all of the $_POST and $_GET values and sanitizes them(mysql_real_escape_string, stripslashes in php).

    Now setting up my form data in html.. php can process form data “arrays” and by that I mean if I have a form input named “employee[name]” and I submit that form, php will recognize that form submission as $_POST[’employee’][‘name’].. pretty amazing I know. Now, each form has its own specified fields that are required to the model. I simply call my model, set the model data to $inputClass->post(’employee’) (which is an array) and save the data.

    I prefer this general method to anything. Its fast and easy to setup, its secure and it works.

    EDIT: Also, something like Ajax and Javascript are luxuries. You don’t NEED these to process forms, they simply add ease to the user. For example, pending they have javascript enabled, you can validate the form without reloading the page. But note, you should always validate your forms via php as well.

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

Sidebar

Related Questions

Do you know any ways to protect a database in Android? I would like
I would like to know if there are any ways one can perform 'locking'
I'd really like to know the various ways I could select a directory with
i would like know some reference. I know i can googling it. but prefer
Would like to know what a programmer should know to become a good at
Would like to know the c# code to actually retrieve the IP type: Static
Would like to know how to integarate cruise control with maven? Cruise Control comes
Would like to know how to hide an div after a set of css3
I would like to know if I can open 2 different diagrams using MS
I would like to know which dependency described in my pom.xml brings a transitive

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.