Accepting PHP in a text box may be too dangerous trying to find another solution

I had a problem finding some way to accept the data below and being able to parse it as arrays, etc. in PHP or Python.

$data = array(
    'full_name' => array('name'=>'Full Name', 'type'=>'textarea'),
    'company' => array('name'=>'Organization', 'required'=>true),
}

There are many more fields in this internal array, and there is no specific order in how they appear.

Is there any way for parsing user input from a text field and its ability to use it as an array, which it is? Or any other ideas on what to do with it?

+3
source share
3 answers

How about using JSON as input format? This can be easily analyzed and will not be a security risk.

+7
source
+3

In Python, you can use ast.literal_evalparsing strings in a dictionary.

+1
source

All Articles