I'm a little confused. I run all my inputs through the basic sanitize function, which I write to allow certain characters, but characters such as []are still allowed.
function sanitize($input) {
$pattern = "/[^a-zA-z0-9_-]/";
$filtered = preg_replace($pattern, "", $input);
return $filtered;}
Any idea why this is so?
source
share