I've already examined and considered most of these methods. The first problem is that the data are not being stored in a database as this point, they are maintained in the SESSION because the user may or may not be logged in at this point; in fact for some applications the shop master may not want users to have to be logged in. For example, PayPal has its own forms that can be linked to as a checkout option, so the online shop does not need to handle user processing at all, merely pass the items and costs. The shop's records are not created until a successful PayPal transaction is returned, and these may consist of email notification that is input into a local database.
in principle, this is no different from logging, and doesn't require a login by the user: why not have a separate table, or even a text file, or a flat berkely db separate from the main db that simply records the on-the -fly generated timestamp&ip ids, separate from any cart issues. The records can expire after a certain time, so the maximum size of the table/file would be as many cart transactions take place in the expiry period, probably a small number, ie avg 10 users, x 1 transaction a minute x 24 hour expiry = 14,400 lines/records.
The second reason is that a customer may wish to repeat the order intentionally. His cart will show how many of a given item he has ordered, the item's individual cost, and a running subtotal. If the customer decides to order another of a given item, then the quantity of that item is incremented and the running total recalculated.
Sure, but since the detection would only happen when someone backs into something that has already been processed, do you think that anyone is going to repeat orders by using the back button**? What's being detected is a duplicate timestamp & ip, nothing to do with the contents of the order. If a repeated identifier is found, then a mechanism like a popup or a div that you make visible could ask if that is the user's intended action.
(** to clarify: I understand that someone might back up to a previous page to increase an order, or reduce it or whatever. By putting a confirmation page after the user says 'add to cart', with a 'continue shopping' button, it will usually be that page that they hit first, and that's where the action you are flagging takes place. If they use the Back menu to go directly to where they can specify the type and quantity, then there is no problem, no?)