que me dicen?
es efectivo?
se aplica de entrada o salida?
ahi va
Código PHP:
Ver original
<?php function h($string, $esc_type = 'htmlall') { switch ($esc_type) { case 'css': // get rid of various versions of javascript '/j\s*[\\\]*\s*a\s*[\\\]*\s*v\s*[\\\]*\s*a\s*[\\\]*\s*s\s*[\\\]*\s*c\s*[\\\]*\s*r\s*[\\\]*\s*i\s*[\\\]*\s*p\s*[\\\]*\s*t\s*[\\\]*\s*:/i', 'blocked', $string); '/@\s*[\\\]*\s*i\s*[\\\]*\s*m\s*[\\\]*\s*p\s*[\\\]*\s*o\s*[\\\]*\s*r\s*[\\\]*\s*t/i', 'blocked', $string); '/e\s*[\\\]*\s*x\s*[\\\]*\s*p\s*[\\\]*\s*r\s*[\\\]*\s*e\s*[\\\]*\s*s\s*[\\\]*\s*s\s*[\\\]*\s*i\s*[\\\]*\s*o\s*[\\\]*\s*n\s*[\\\]*\s*/i', 'blocked', $string); $string = preg_replace('/b\s*[\\\]*\s*i\s*[\\\]*\s*n\s*[\\\]*\s*d\s*[\\\]*\s*i\s*[\\\]*\s*n\s*[\\\]*\s*g:/i', 'blocked', $string); return $string; case 'html': //return htmlspecialchars($string, ENT_NOQUOTES); case 'htmlall': case 'url': case 'query': case 'quotes': // escape unescaped single quotes case 'hex': // escape every character into hex $s_return = ''; } return $s_return; case 'hexentity': $s_return = ''; } return $s_return; case 'decentity': $s_return = ''; } return $s_return; case 'javascript': // escape quotes and backslashes, newlines, etc. case 'mail': // safe way to display e-mail address on a web page case 'nonstd': // escape non-standard chars, such as ms document quotes $_res = ''; // non-standard char, escape it if($_ord >= 126){ $_res .= '&#' . $_ord . ';'; } else { $_res .= $string{$_i}; } } return $_res; default: return $string; } } ?>