.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
So you think, all major website, Amazon, buy.com, etc., never use simple sequence as customer id or order id, they just did it for fun and for no reason?
From technical point of view, it is not a good idea that a hacker can easily guess out all the IDs.
Anyway, this is off the topic. Let's focus how to do it. Not why to do it.![]()
The current version of Zen Cart exerts no control over order numbers or customer numbers. It leaves that up to the database to handle via an auto-increment counter. That means when a new record is added, the database automatically picks the next integer number greater than the last one used. That's all handled by MySQL, not Zen Cart.
I guess you're welcome to rewrite how MySQL works when adding +1 to numbers. You'll need a dedicated server to install your own customized C++ code, then compile the new code after you've written the new functionality, and then run your site from that. Of course, then all the *other* database tables that do other auto-incrementing will grow exponentially large and blow out capacity too.
Assuming you're probably not interested in tackling it that way, we come back to finding a solid reason for thinking it's needed in the first place.
I see no threat with regard to a hacker guessing customer IDs or order IDs. How exactly do you think those can be abused if they can be guessed? I'd be very interested in exactly what threat you think exists.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
I'm sure they had good reasons for generating customer and order ids in a different way, but with the volume of business they do, how could sequential numbers hurt them? I suppose a hacker could guess a valid number more easily if that would benefit them... but it would probably not be hard to guess a valid number like the actual ones, for a hacker who actually knows coding.
Not sure about the customer id, but the order id is a primary key in the database, and needs to be sequential, unless you change the way the db works.
Edit: Yeah, what DrByte said... :)
I can't speak for Amazon, etc., but custom shopping cart software can do a lot of stuff a standard open source cart can't do, and at a much greater expense.
As I mentiioned, you would have to write considerable code to accomplish what you're asking. You might try posting in the Commercial Help wanted forum.
Most importantly, this forum isn't a Knowledge Base where you get pre-written answers depending on keywords in your question. It's a community, and the why is often more important than the how.
I and (apparently) others think your approach doesn't make sense, and we'll be pleased to say so.