Merge pull request #206 from copenhagentruckwash/fix-sql-injection-in-vehicle-plate-history

Fix SQL injection in vehicle plate order history lookup
This commit is contained in:
Jeppe B
2026-06-01 22:59:14 +02:00
committed by GitHub
+2
View File
@@ -270,6 +270,8 @@ class orders_o extends db
public function getOrderHistoryByVehiclePlate(string $plate, int $entries = 10): array
{
global $db;
$plate = $db->escape_string($plate);
$entries = max(1, $entries);
$sql = "SELECT * FROM $this->table WHERE reg_1 = '$plate' OR reg_2 = '$plate' OR reg_3 = '$plate' ORDER BY id DESC LIMIT $entries";
$result = $db->query($sql);
return $db->fetch_all($result);