If you have ever looked at the address bar of an online store, you have seen a URL like this: https://www.example.com/product.php?id=1
Modify your products table:
$slug = $_GET['slug']; $stmt = $pdo->prepare("SELECT * FROM products WHERE slug = :slug"); In 2023, a small electronics retailer contacted our security team. Their site followed the classic "php id 1 shopping" pattern. A hacker used a tool called sqlmap on their product.php?id=1 endpoint. php id 1 shopping
ALTER TABLE products ADD COLUMN public_id CHAR(36) NOT NULL UNIQUE; UPDATE products SET public_id = UUID(); Now your URL becomes: product.php?id=3f7e8a9b-2c4d-4e5f-8a9b-0c1d2e3f4a5a If you have ever looked at the address