Nasıl veritabanından ürün kimlikleri sağlamak tahrif değil

0 Cevap php

I have this small PHP/MySQL cart system that users add products to, checkout, and pay.
These products all have IDs on them so that when the user checks out,
I can get that product's attributes (price, weight, the vendor's account id, etc).

Right now it would be really easy for someone to open up Firebug,
guess another product ID, change it, and checkout.

What would be the best way to prevent this?
The store and the checkout system are on two different domains if that matters.
I could use something like a unique token
but how would that work if multiple customers could be using the cart at the same time?

EDIT: Vay, bazı önemli detayları atlamış, bu çok hızlı yazdınız. Sepeti şu anda PHP oturumda depolanır ediliyor JSON olarak temsil edilir. Tüm ürünler bir satıcının hesabına onları ilişkilendiren bir hesap_kimliği var.

Bir kullanıcı ürün kimliği değişti ve istenmeyen olurdu (aslında farklı bir şirketin deposundan başka bir şirketin ürününü satın aldığınız) başka bir satıcının hesabı altında bir ürün almak oldu eğer sorun oluşacak. Şimdiye kadar cevaplar için teşekkür ederim.

0 Cevap