Using Zygodact to add a registration system to your stack or standalone
This lesson shows how to use Zygodact to create a registration and serial key system for use in a standalone or mainstack.
Launch Zygodact and click "Create Set" to make a set of registration files for use with your stack. It's a good idea to leave the CGI checkbox selected. The CGI files allow you to use Zygodact registrations on a web site. Because every set of registration files is unique, you can't add CGI options later. It's best to create all the files at the same time, even if you don't plan to use the internet for registrations. That way if you change your mind later, you'll have the files you need.
Zygodact creates four files which work together to form your unique registration system. No two sets of files are the same, and you can't mix files from different sets. The files you will see on your desktop are:
1. Register.rev: This Rev stack will become a substack of your main stack. It displays a registration dialog which your customers fill out to complete their registration.
2. Key Generator.rev: This Rev stack is for your own use, and generates unique serial keys that you will send to your customers.
These two files are all you need for a standard registration system. However, if you want to allow registration from a web site, you will also need the other two files:
3. keygen.cgi: This standard CGI text script goes into the cgi-bin folder on your web site, and returns serial keys when its URL is requested.
4. gen.rev: This Rev stack also goes into the cgi-bin folder. The CGI script uses it to generate the serial keys it sends back.
The Register stack must become part of your stack file. To embed the Register stack in your project, open both the Register stack and your main stack in Rev. Open the Property Inspector for the Register stack. In the Basic Properties pane, choose your main stack from the “Main stack” popup menu. Then save your main stack.
You don't need to settle for the plain white Register stack. You can enhance it in any way you like: add images, resize it, add text, or anything else that doesn't require changing its script.
All of Zygodact’s functionality is automatic. You only need to call it with a single line of script whenever you want to check the validity of a registration. Generally this will be immediately when your standalone opens, in a preOpenStack or preOpenCard handler, but it can be done any time you need to check the registration status.
To tell Zygodact to check registration, place this line in an appropriate handler in the main stack:
send "zygodact" to stack "register"
When you're ready, compile your standalone. Revolution’s standalone builder can’t do automatic inclusion checking if a password-protected stack is part of the stack file. When you include Zygodact in your main stack, you will need to open Standalone Application Settings from the File menu and check the box that allows you to select inclusions manually. If you leave the default auto-checking turned on, the standalone builder will exit with an error.
You can also use Zygodact registration with stacks that are not compiled into standalones. The above steps all work with regular stacks too. Of course, you'll want to password-protect your stack to prevent people from seeing your scripts and bypassing registration.
To create a serial key for a customer, open the Key Generator in Revolution. Enter the user's name or any other identifying text you decide to use (many developers use an email address instead of a name.) Then click "Make One Key". A unique serial key is created for that customer, based on the text in the name field. Alternately, you can create any number of unique keys at once by supplying a return-delimited list of names. Zygodact will create a text file with a unique registration key for each line in the list.
You can decorate and customize the Key Generator stack too if you like, or compile it into a standalone.
To use web-based registration, drop a copy of Rev and the two CGI files into the cgi-bin folder on your web site, and then get the CGI URL when you need a serial key. Zygodact's scripts work very well with on-rev servers and you can see an example of that in action, along with setup instructions and irev code, at http://jacque.on-rev.com/zygodemo/getkey.irev. Zygodact's documentation also has more about scripting CGIs, as well as info on storing the user's registration status, setting up a free demo period, internationalizing the prompt in the Register stack, and much more.