![]() 3D 3D Photo Gallery (Part 1) 3D Photo Gallery (Part 2) Audio Poor Man's MIDI Make A Metronome iPod Tricks (Part 1) iPod Tricks (Part 2) iPod Tricks (Part 3) Laugh Track Machine Audio Player with Reverb Shepard Melody RB Phone Home Build a Drum Machine Custom Controls and Windows Double Click Listbox Draggable Metal Window Double Click Canvas Custom Buttons Custom Buttons Part II iTunes-style Listboxes Custom Controls General RB Scrolling Windows Using Mesage Dialogs Case-Sensitive Word Finder Introduction to Stacks Wiggle Window JPEG in PDF Listbox Checkboxes Background Applications Listbox Auto-Find Virtual Volumes Time Tracker Software Distribution (Part 1) Software Distribution (Part 2) Software Distribution (Part 3) Software Distribution (Part 4) Exceptions Tips and Tricks Text Clippings Made Easy Graphics Drawing a Simple Gradient The SpriteSurface: Space Game Image Spinner Cropping Graphics (Part 1) Cropping Graphics (Part 2) Cropping Graphics (Part 3) Cropping Graphics (Part 4) Shimmer Graphics Lissajous Figures Simple Screen Capture Vector Graphics Kaleidoscope Images Stegonography Spirals! Image Table RB Magnifying Lens Screen Capture Color Picker Tutorial Hacks Ghost Grab Speedy Mouse Extension iTunes Plugins iTunes Skinner Mac OS X Global Hot Key Event (Carbon Events) Login Welcomer (Carbon Events) Add/Remove Buttons Resizable Sheets Mac OS X Preferences Window Using Sheets in REALbasic Build a Bundle (Part 1) Build a Bundle (Part 2) Dock Your Passwords Mac OS X Debugging REALbasic Mac OS X Icon Tutorial Animate Your Dock RB and the Command Line Menus Window Menu Templates Menu Listbox Menu Novelty Guessing Game Calendar Trivia Tile Mixer Zip Code Finder Happy Valentine's Day Merlin Simulator (Part 1) Merlin Simulator (Part 2) Merlin Simulator (Part 3) Buzzword Machine AppleSoft BASIC Printing Print to PDF Registration Registration Code Validation Network Registration Codes Resources Picture Extractor (Part 1) Picture Extractor (Part 2) Serial Caller ID (Part 1) Caller ID (Part 2) Caller ID (Part 3) Speech Speech Recognition Socket Communication Easy Peer-to-Peer File Sharing MacPAD Version Checking Display Web Image In Canvas HTML IMG Tags Version Tracking Even Smarter Instant Messaging Web Tiler JavaScript and REALbasic Stock Ticker (Part I) Stock Ticker (Part 2) AIM Mate XML Manipulation Simple XML Introduction Video Big Brother Video Capture Note: All articles without a byline were written by Erick Tejkowski. When cleaning the site I removed them because the code differed from page to page, and I have yet to put them back in.
Tell us about a bad link. |
Registration schemes are always "beyond" new programmers. If you're on the REALbasic mailing list, you'll see a message about once every other month on the topic, and the main reason is, new programmers, or more correctly, new registration scheme coders, don't know what a registration scheme is and are afraid of doing it wrong. (And you can believe me because I was one of them.) The strange thing is, there is no way to do it wrong. What are registration numbers and generators? An Example ABC12345 and 10A20763, but QEP10310 would not work because Asc("Q") * Asc("E") / Asc("P") + 10310 is equal to 10379.86 which does not meet our requirement. Also note that 10A2076B would not work because the last character is a letter and not a digit. So you see, all that a registration code generator must do, is produce numbers which meet a strict set of rules created by the registration code validator. This Tutorial's Project Ok, well start by creating a new project and make an interface that looks like this:
Ok, now the format of the registration numbers we're going to be making will have two letters, 3 numbers, a hyphen, and then two sets of four numbers also separated by a hyphen: SF100-4944-9222 The first character will be what kind of license it is. S is for single, M is for multi, and G is for group. "F" is just a single character for you to know which application the registration code belongs to, and the next three characters are the version number of the application and can be used to test different versions of the registration algorithm, but we won't go into that so just call it filler space, and then the next 8 numbers are the real meat of the code. These 8 bytes will be the realy "generated" part of the number, and the bytes we use to do validation with. Code Generation
(Now we reall don't need to do this, but it really helps to clarify what is where as far as which character is in which byte position. All that we really need to do is assign a character to byte 1 to represent which application it is, the version number to bytes 2-4, and hypens in bytes 5 and 10. All of the other bytes are just overwritten.) Next, assign the value of the first byte to be a character representing which of the three license types the user bought (S for single, M for mutli, and G for group).
(Now from here on, the numbers and characters you use are ultimately up to you; Just keep in mind that this is one example of how you might create a registration code generator, it's not the "right way.") Next we're going to assign the 8th, 4th, 3rd, and 1st characters of the user's name to the 6th, 7th, 8th, and 9th bytes of the "code" memoryblock respectively. After that, we're going to do some random math with the value of these four bytes and come up with a number. Using "Seth Willits" as an example, the number generated by the code below is 4076.
Then we're going to take that number and place it in those 4 bytes (6, 7, 8, and 9).
Then for our next four bytes, or the last for characters of our registration code, we're going to a very similar process but change the math just a little bit and use different characters of the name to start with.
Now after assigning those last four characters, you're done generating the number for that name, so go ahead and put that number into the code field: CodeField.Text = code.StringValue(0, code.size) Code Validation Ok, well anyway, go ahead and implement this interface:
Next, copy the code which creates the registration code into the validate button, delete the lines that test which radio button is selected, and instead of the last line (CodeField.Text = code.StringValue(0, code.size)) write: if Mid(CodeField.Text, 2) = code.StringValue(1, code.size - 1) then So the code you end up with is:
Go ahead and try it with different names and test validating with the correct codes and wrong codes. Pretty cool, huh? As you may have noticed, this example is not 100% "perfect" but works 100% of the time. For example, names with fewer than 8 characters will generate semi ununique numbers. In reality, even with this possibility, the method still works and works well. I've even implemented a version of this same type of algorithm in my own applications because it's simple and effective. With registration validation, anything goes. The really tricky part is trying to keep crackers or warez groups from redistributing your serial numbers! |
|||||
|
Please support ResExcellence by Visiting our Sponsors. One click makes a difference. |
||||||
|
|