Use bound parameters for every query that takes user data.
The queue image query took $id without quotes or a check, which allowed SQL injection.
This commit is contained in:
+3
-5
@@ -14,11 +14,9 @@ if (isset($_SESSION['editor'])) {
|
||||
$table = "editors";
|
||||
open_db('open');
|
||||
|
||||
$username = $db->real_escape_string($_POST['username'] ?? '');
|
||||
$query = "SELECT * FROM $table WHERE ".
|
||||
"username LIKE '".$username."' ".
|
||||
"LIMIT 1;";
|
||||
$getid = $db->query($query) or die("Query failed: ".$db->error);
|
||||
$username = (string)($_POST['username'] ?? '');
|
||||
$query = "SELECT * FROM $table WHERE username LIKE ? LIMIT 1";
|
||||
$getid = $db->execute_query($query, array($username)) or die("Query failed: ".$db->error);
|
||||
$row = $getid->fetch_assoc();
|
||||
|
||||
$stored_password = '';
|
||||
|
||||
Reference in New Issue
Block a user