Forum Moderators: buckworks

Message Too Old, No Replies

Order Numbers

Generating order numbers - how to...

         

mipapage

9:05 am on Sep 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

I'm building a simple shopping cart for a site that will be selling only a couple of products - No database will be used for this.

We're posting data to a TPV, and need to send in the client ID and an order number to start the transaction - I'm a bit stumped about how to handle the order number...

Without a database or anything to refer to, I could generate an order number by having the user type in their name, and with PHP append a date and time to the name and from that make an order number,

or,

so that they don't have to enter their name twice (here and on the CC submittal) I could just use the date and time and append a couple of random numbers, for example...

DaveN

8:22 am on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



can't you read a number from a text file increment and rewrite. personally I would use a database.

Dave

jpjones

8:56 am on Sep 11, 2003 (gmt 0)

10+ Year Member



I agree with DaveN - without a database, a textfile is the easiest way to go about it to get incremental order numbers. Just make sure you lock the file between getting the current contents and writing the new number into the file, or else if you have two orders going through at the same time, both orders will have the same order number.

mipapage

12:33 pm on Sep 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the replies - I have found an answer that I think will work, though the project stalled waiting for the bank (tpv)...

Cheers - mipapage

apsunick

7:07 pm on Sep 17, 2003 (gmt 0)

10+ Year Member



using incremental order #'s is a major security issue. I wouldn't take that approach.

coopster

7:26 pm on Sep 17, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Incremental order numbers aren't a security issue, as a matter of fact they are quite common and often used. However, the code you develop to allow access to and processing of the order number(s) is a different story...

And as far as order number duplication, a database with an AUTO_INCREMENT order number is much easier to code as opposed to the code required to lock and update an order number data area or text file. I've done both. My suggestion is to follow the others advice and use a database.

Something else to consider: it may be a

simple shopping cart for a site that will be selling only a couple of products
now, but as you enhance or move forward, you will likely want to build on your initial development. Another reason to use a database now!

Best of luck with your new system -- Coopster

apsunick

8:17 pm on Sep 17, 2003 (gmt 0)

10+ Year Member



Yes the code base is important part, but the easier you allow others to figure out things like order #'s the greater potential for fraud.

bekyed

8:25 pm on Sep 18, 2003 (gmt 0)

10+ Year Member



The best solution is microsoft access as this will allow you to password protect all of your valuable data

Bek

mipapage

1:50 pm on Sep 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks a lot to all of you for your replies - the project is still stalled, but should be going in a day or so - I appreciate the advice!