<p>The UNIX-version of the key generator is a PHP file that contains all necessary information for serial number generation. The file is located in <strong>Keygen\PHP</strong>. Below we describe the key points of using such a generator.</p>
<h3>Configuring the generator</h3>
<p>In the beginning of the PHP file, the setup code is located:</p>
"../licenses.htm#export">Exporting product parameters</a>) and is unique for each particular product. It is crucial to copy it accurately, as otherwise the generator will work incorrectly.</p>
<h3>Contents of a key</h3>
<p>Then, the generator specifies the contents of a serial number
The contents are specified in an array, with all possible parameters of the key listed below. However, in real applications, some of them may be omitted:</p>
<p>Below you can see a simplest function called upon successful generation of a serial number. The only parameter sent to it is a serial number string. The function must pass the serial number to the caller (an e-commerce agent), usually with the <strong>echo</strong> command. The string is preliminarily split to sub-strings 75 symbols each, for convenience. Also, this function could send the generated serial number by e-mail to the developer or add it to a database.</p>
<p>The final part of the code that needs our attention is a function called when something goes wrong. This function receives a string with the error message, and when it finishes, the <strong>die()</strong> function is called. The handler function must do two things: instead of a key, return to an e-commerce agent a message saying the key will be sent manually. And send to the developer an exhaustive information about the error to fix it and generate the key manually.</p>
<strong>echo</strong> "You will receive serial number in the next 24 hours"; // message to the customer
// mail("support@vendor.com", "Houston, we have a problem", $details); // message to vendor
}
</pre>
<p>There are several possible causes of mistakes: incorrect parameters of the algorithms, incorrect parameters of the key, a too long user name or e-mail, or a too long serial number that doesn't fit to the number of bits specified in the algorithm.
That is why the <strong>OnSerialGenerationFailed</strong> function must send a detailed information about the issue to the developer, so he could generate a serial number and send it to the customer.</p>
<h3>Other things to consider</h3>
<p>Examples hold a simplified version of the key generator. It doesn't take into account <ahref="index.htm">recommendations to develop web generators</a>. It does not check the IP address of the caller and does not analyze input parameters. Please pay attention to this when developing your own generator based on this one.</p>
<p>A user name and an e-mail must be passed as UTF-8 strings. Make sure your e-commerce agent sends these data in the UTF-8 encoding, or transcode the information if this is not so. Wrong encoding won't lead to an incorrect serial number generated, but the registration name displayed for such a serial number can be different from the real user's name, so he or she may be surprised to see it in the "About" window of the application</p>
<p>Asymmetric encryption is a complex mathematical process. If it is implemented using pure PHP without any third-party libraries, serial number generation can take dozens of seconds. The generator uses
<strong>bcpowod</strong> functions whenever they are available. If serial number generation take too long on your hosting, we recommend to ask the hosting provider to enable these functions. For example, the <strong>gmp_powm</strong> function works ten of times faster than <strong>bcpowmod</strong>.</p><br/>