Parameterized Query
Task:
Implement a fix to block SQL injection into the fields in question on
the Login page. Repeat stage 1. Verify that the attack is no longer
effective.
Problem
1.Password max size
2.Code is parametarized
Parameteried code would be like below
// prepare and bind$stmt = $conn->prepare("INSERT INTO MyGuests (firstname, lastname, email) VALUES (?, ?, ?)");
$stmt->bind_param("sss", $firstname, $lastname, $email);
// set parameters and execute$firstname = "John";
$lastname = "Doe";
$email = "john@example.com";
$stmt->execute();
$firstname = "Mary";
$lastname = "Moe";
$email = "mary@example.com";
0 comments:
Post a Comment