Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3423386
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:20:55+00:00 2026-05-18T06:20:55+00:00

I have this small PHP/MySQL cart system that users add products to, checkout, and

  • 0

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: Wow, typed this too fast, left out some important details. The cart is currently represented as JSON that is being stored in a PHP session. All products have an account_id that associates them with a vendor’s account.

The problem would occur if a user changed the product id and happened to get a product under another vendor’s account (essentially purchasing another company’s product from a different company’s store) which would be undesirable. Thank you for the answers so far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:20:56+00:00Added an answer on May 18, 2026 at 6:20 am

    Use a server side session to store the cart details.

    Every session gets a unique ID, stored in a cookie. All details (selected items, amount, etc) are tied to this sessionId.

    By definition, you do not want different customers to use the same cart. Instead, every custommer uses their own separate copy of the cart.

    If you need to ‘share’ the sessionId with some external service, instead calculate a separate unique key and share this key with the third party service (=checkout service in your case).
    This ensures that you can uniquely identify your customer in communications with the thirds party, without the third party knowing anything about how you identify or communicate with your customer on your side of the fence. (the important thing to remember is, a sessionId is a shared secret, nobody else should ever know about it).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small PHP Mysql function which generates all the columns within a
I have this small code library that I'm considering releasing into Open Source. I
I have this small class called City that simply holds some information about a
I have developed a small web app. This app allows users to upload images.
We have a small company and we have developed our own CMS in PHP/MySQL.
I have a small PHP framework that basically just loads a controller and a
So I have a small PHP script that generates an xml feel for the
I have a small PHP mysql query looking at a table in my database.
I have this small project I have been working on. I have a MySQL
I have a small php app that I want to build a layer of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.