Sanitize Database Query
Permalink
I am from a Drupal background and am looking for the way concrete5 executes database queries to prevent SQL injection.
$db->Execute('SELECT firstName FROM friends WHERE sex = $_POST['sex']);
Obviously what I have at them moment is very poor, what is the way to generate dynamic queries the Concrete5 way?
$db->Execute('SELECT firstName FROM friends WHERE sex = $_POST['sex']);
Obviously what I have at them moment is very poor, what is the way to generate dynamic queries the Concrete5 way?
Concrete5 uses the abodb php library. It's pretty straightforward. There is some decent documentation here.
http://phplens.com/lens/adodb/docs-adodb.htm...
http://phplens.com/lens/adodb/docs-adodb.htm...
before that I would look for valid erhm inputs for sex, and throw away any input that doesn't match via an in_array method.