Posted By

TheNullByte on 06/19/12


Tagged

php input clean user sanitize


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

DanielLucia
ekarakas


Sanitize (MySQL and XSS)


 / Published in: PHP
 

Just a small function to sanitize the user's input of any xss and sqli. I saw a lot of ones that didn't include htmlentities or htmlspecialchars, and were still vulnerable to persistent/reflected xss.

  1. function clean($a)
  2. {
  3. {
  4. $a = stripslashes($a);
  5. }
  6. $a = htmlentities($a);
  7. return $a;
  8. }

Report this snippet  

You need to login to post a comment.