So I found My page to be very vulnerable to sql injection attacks, I wish to patch it but a bit confused where to start, Ive done some research and I think I should be using PDO, basically from what I understand I need to be Pre-making my statements and then parsing there input as a string, As this is the first time doing this I would like to make sure I'm going own the right path,
So for example, this statement in my login page php code:
$verify_pass = $dB1->query('SELECT * FROM accounts WHERE account="'.$compte.'" AND pass="'.$pass.'"');
It's to my understanding I should be changing this to
$verify_pass = $dB1->prepare('SELECT * FROM accounts WHERE account="?" AND pass="?"');
$stmt->bind_param("sss", $user, $pass);
and then save there input as $user, Would this work to prevent an sql injection attack, I would obviously need to do this for every user input surrounding the database but is this a step in the right direction?