J
J
jasonOk2015-11-19 11:33:26
PHP
jasonOk, 2015-11-19 11:33:26

How safe?

I use PDO (bindParam) and filter all data through filter_var() FILTER_SANITIZE_NUMBER_INT or FILTER_SANITIZE_STRING .
Is this enough for security? Isn't it required to additionally do htmlspecialchars, for example?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2015-11-19
@miraage

Enough, all is well. By the way, PDO can do it too.
htmlspecialchars should only be used when outputting data to the browser, when it may contain content sent by the user (untrusted content), or in other cases when you need to escape the output.

X
xmoonlight, 2015-11-19
@xmoonlight

I always make my own regex filter for peace of mind: you never know?!

O
OnYourLips, 2015-11-19
@OnYourLips

and I filter all data through filter_var() FILTER_SANITIZE_NUMBER_INT or FILTER_SANITIZE_STRING.
It is pointless.
No "protection" is needed if you use PDO correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question