Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 12-16-2013, 01:02 PM   #1
Beta Member
Join Date: Dec 2013
Location: georgia
Posts: 1
Default How to make automatic code changer?

Hello in the first place, I want to know how to create automatic code changer or generator don't know what it's called exactly but it should do following. When my client buys my product it will redirect him/her to the page where will be specific code like ( a15kuf6e or something like that) which will change every time new costumer purchases something.
Thanks in advance

snic is offline   Reply With Quote
Old 12-18-2013, 11:37 AM   #2
Site Team
root's Avatar
Join Date: Mar 2004
Posts: 8,088
Default Re: How to make automatic code changer?

You men registration/serial code type generation.

what's this code going to be for? I mean will your software be unregistered without it?

If you're writing and selling a product that requires a serial code to be generated then you've probably already got some kind of process for generating serials? (manual or a separate program?) all you have to do is take that logic and put it into a web page.

if the question is a bit more broad than that (like how do you write software that's crippled or won't run unless it has a serial number, then your serial generator has to match up with the software that you're licensing...)

you see how writing the website to give out the codes might be starting at the wrong end of the problem...

when you've figured out how to write the software that requires a serial key, then generating a serial key becomes the easy bit! -because you know what the program is looking for.

or are you looking for some kind of support number?
(like you are customer number ####,)

in that case, if you;re assigning customers customer numbers that are unique you should probably store them in a database, and they should be sequential rather than random, and form a unique ID in the table (possibly the primary key linking order IDs to customer details and order details)...

Again, when you're written the site for customers to add their details to buy the products etc, just retrieving the auto-incremented field is a pretty simple job.

I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 02-01-2014, 10:32 AM   #3
In Runtime
Join Date: Feb 2013
Location: UK
Posts: 156
Default Re: How to make automatic code changer?

You're basically describing a transaction reference code. Presumably you don't want this to be sequential otherwise you wouldn't have asked, therefore I'd suggest the following:

1) Query any suitable PRNG (pseudo-random-number-generator) function from a reputable crypto library (openssl, etc.) for a new value
2) feed this value into a hash function (e.g. SHA-1, md5 etc.) - again, available from your crypto library
3) take the first n bytes of the resulting alphanumeric string (these strings are hexadecimal numbers) - say around 8-10 - too long a substring will be take more space in a database to key on and be prone to mis-quoting by customers calling support staff, whereas too short a string increases the probability of a 'hash collision' (i.e. a duplicate). Therefore it's worth being too long than too short.
4) use this 8-10 (or whatever you choose) substring to key your database and store all your required transaction information (product id, quantity, unit price, total price, customer id etc.) alongside it.

One thing I would say, irrespective of the above suggestion, is that if you're not clear on exactly what your system design is (which since you're asking this question you won't be), make sure to seek some professional review of your architecture, database model and associated code. It is very easy to make mistakes in this sort of software which could lead to a lot of headaches for you and your customers down the line.
_michaelm is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 07:58 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0