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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:47:55+00:00 2026-06-01T22:47:55+00:00

I have controller that takes post parameters from HTML form, it will then send

  • 0

I have controller that takes post parameters from HTML form, it will then send them to model that will insert the array into Cassandra database.

It is SQLInjection proof, because it’s NoSQL, however what I’m afraid is that user can just simulate 100k post parameters or just add some that I don’t need and it will be inserted into database. How can I make sure that only the values I need will stay in my array.

Example:

$post = ['parent_id', 'type', 'title', 'body', 'tags']; // Good
$post = ['parent_id', 'type', 'title', 'body', 'tags', 'one', 'two', 'three'] // Bad

How do I make sure that my array will unset all the elements that are not in good example?

  • 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-01T22:47:57+00:00Added an answer on June 1, 2026 at 10:47 pm

    You are looking for array_intersect:

    $good = ['parent_id', 'type', 'title', 'body', 'tags'];
    $post = ['parent_id', 'type', 'title', 'body', 'tags', 'one', 'two', 'three'];
    
    print_r(array_intersect($good, $post));
    

    See it in action.

    Of course this specific example does not make much sense because it works on array values, but there is also array_intersect_key that does the same based on keys.

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

Sidebar

Related Questions

I have an controller that returns JSON. It takes a form, which validates itself
I have a generic dispatcher that takes in parameters and then make $.ajax() As
So, I have this variable that I push into the controller via POST from
I currently have a Spring MVC controller that takes a MultipartFile @RequestMapping(method = RequestMethod.POST)
I have multiple controller actions that takes an id public ActionResult Get(int? id) {
--Summary (shortened)-- I have a controller that loads a profile object from the corresponding
I have a form that takes date range value to generate a report with
I have a controller POST action that redirects to a GET method using RedirectToAction.
I have a controller action UpdateCustomer(CustomerDto customer) that returns a PartialViewResult with a model
Interesting situation. I have a Html.Textbox() that I render from a view as follows:

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.