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:
tim
2026-09-25 21:29:09 +02:00
parent cda0602c95
commit c85f54116c
7 changed files with 70 additions and 89 deletions
+3 -5
View File
@@ -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 = '';