PHP and javascript snippets you can copy and paste.

Saturday, March 31, 2007

sec_remove_emailInjectionChars($str)

/**
* Removes email injection characters from a string.
* Credit: http://www.securephpwiki.com/index.php/Email_Injection
* @param string $str - string to remove email injection characters from.
* @return string.
*/

function sec_remove_emailInjectionChars($str){
return str_replace("\n",'',str_replace("\r",'',str_replace("%0A",'',$str)));
}

No comments: