-1

I need to store data in a mysql table then output it to the user.

I am sanetizing "name" and "comment"

On name im using strip_tags and trim, then storing it with stmt prepare/bind_param.

And on "comment" im using nl2br/htmlspecialchars then storing it with stmt prepare/bind_param, since users must be able to hit enter/linebreak.

So is this enough to protect me against XSS/SQL-injections?

Thanks

1 Answers1

-1

strip_tags hmmm.. look on other question

Moreover you are changing user input, I think it's better to show complete input (safely)

htmlentities($str, ENT_QUOTES, "UTF-8");

and next question

Community
  • 1
  • 1
kwarunek
  • 12,141
  • 4
  • 43
  • 48