Created
March 18, 2012 13:42
-
-
Save ruprict/2072748 to your computer and use it in GitHub Desktop.
Kennedy Article on Rails Secuity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
// ... | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI, a bit more terse: https://gist.github.com/2140151