1
It’s wrong or unsafe to use:
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
foreach ($_POST as $key => $value) $$key = $value;
...
}
Let’s say I have this code, but use a Procedure call with prepare on variables. I run some risk of attack by Sql Injection
?
Being a little more specific, my problem is in:
foreach ($_POST as $key => $value) $$key = $value;
I have an analysis and security report on my system saying that this is a serious flaw of SQL Injection. Even if I’m using PDO and prepare after that!
Hello @Renan the answers on this link are good. But I already run these practices and msm so my system is seen as veranenenenevel just by this snippet of code shown above!
– alan
Use
filter_input
and be happy!– Maurivan
If you have a specific problem, you should post it in detail to anyone who can help you. So generic has already been answered.
– Maniero
Use PDO and Prepared statements, and be happy (2)
– Rodrigo Jarouche
@Rodrigosartorijarouche unfortunately this is not enough. Because already use PDO and Prepared and thought that would be enough to be 100% safe. But find q there are more things to worry about!
– alan
@Alan uses The Prepared statements + filter_input
– Rodrigo Jarouche
uses filter_input together, you’re right I also thought enough and is not...
– Rodrigo Jarouche