Sanitize (MySQL and XSS)


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

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.


Copy this code and paste it in your HTML
  1. function clean($a)
  2. {
  3. {
  4. $a = stripslashes($a);
  5. }
  6. $a = htmlentities($a);
  7. return $a;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.