public
Created

Kennedy Article on Rails Secuity

  • Download Gist
build_params.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?php
 
// ...
protected function build_params() {
$whitelist = array("name", "surname");
 
$params = array();
foreach($_POST as $key => $value) {
if (in_array($key, $whitelist)) {
$params[":$key"] = $value;
}
}
return $params;
}
// ...
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.