clean up values


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. private static $forbidden_chars = array("from","'","union","select","+","0x",">","<","\\","/","\"");
  2.  
  3. static function cleanUp($array) {
  4. if(is_array($array)) {
  5. foreach($array as $key => $value) {
  6. $array[$key] = self::replaceForbidden($value);
  7. }
  8. return $array;
  9. } else {
  10. return self::replaceForbidden($array);
  11. }
  12. }
  13.  
  14. static function replaceForbidden($str) {
  15. return str_replace(self::forbidden_chars, '', $str);
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.