Add-cart.php Num | !!top!!
$item_id = intval($_GET['item_id']); $quantity = intval($_GET['num']);
A request to add-cart.php?num=1.1 returns a MySQL error: "Unknown column '1.1' in 'where clause'" — SQL injection confirmed. add-cart.php num
// fetch product and stock from DB $stmt = $pdo->prepare('SELECT id, name, price, stock FROM products WHERE id = ?'); $stmt->execute([$product_id]); $product = $stmt->fetch(PDO::FETCH_ASSOC); if (!$product) http_response_code(404); echo json_encode(['error' => 'Product not found']); exit; $item_id = intval($_GET['item_id'])
header( "Location: cart.php?status=success" Use code with caution. Copied to clipboard 🛡️ Security Analysis: The parameter is a high-risk vector for Business Logic Vulnerabilities</p> $quantity = intval($_GET['num'])