// Update cart (session example) if (!isset($_SESSION['cart'])) $_SESSION['cart'] = [];
$stmt = $pdo->prepare($sql);
The add-cart.php script and its num parameter might look trivial, but they represent a microcosm of web application security. An unvalidated num is not just a quantity—it is an attack vector for: add-cart.php num
A vulnerable script might look like this: // Update cart (session example) if (