HomePHP Generating Contract Numbers for Online Licenses using PHP and MySQL
Generating Contract Numbers for Online Licenses using PHP and MySQL
PHP and MySQL form a powerful combination of open source technology available to any web developer. One of the increasing trends in modern web development is the generation of online contracts. E-commerce websites selling services online need automated contract generation for faster delivery of services. This article will help you learn to use this technology so you can get it working on your web site.
One of the most common applications is issuing licenses online. In the real world, licenses are issued on paper and signed by both parties. In the online world, this can be done efficiently with an online contract which can be traced by issuing a contract number. Contract numbers are the best way to track those licenses; with every licensing agreement, there should an accompanying licensing contract.
Simple PHP Contract Generation Script
To understand how to generate contract numbers, letís consider a basic example:
echo mt_rand(min, max);
echo '<br />';
This piece of random code will generate random number between min and max. So for example, if you need to generate a random number between 10000 and 15000, the code would look like this:
echo mt_rand(10000, 15000);
echo '<br />';
Bear in mind that 10,000 is the minimum random number that will be generated and 15,000 is the maximum random number that will be generated.
There are a countless number of applications for a PHP random number generator script; these may include games, random number quizzes, number-based passwords, etc.
If you've learned PHP before, you must have met the PHP random number function rand(). This is the classic random number function. In the simple random number generator script above, we are using:
The only difference between mt_rand() and rand() is speed. The mt_rand() function is capable of processing four times faster than the old random generator script.