Punkbastard

XSS Mitigation - PHP

Apr 14th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. /**
  2.  * Escape all HTML, JavaScript, and CSS
  3.  *
  4.  * @param string $input The input string
  5.  * @param string $encoding Which character encoding are we using?
  6.  * @return string
  7.  */
  8. function noHTML($input, $encoding = 'UTF-8') {
  9.     return htmlentities($input, ENT_QUOTES | ENT_HTML5, $encoding);
  10. }
Add Comment
Please, Sign In to add comment