The production of your own module is the easiest. You need only two things for it—an XML file, which describes exactly what the module does and in which files it is located, and the module itself. The first step in the creation of every Mambo extension is to prevent the direct call of the PHP file in order to avoid possible security gaps. A popular trick is to check for the presence of the _VALID_MOS
constant. If it isn't there, the file is not called by Mambo, but directly by PHP. In that case, the following code aborts the script execution immediately:
if (!defined('_VALID_MOS')) { die('direct access is prohibited!'); }
The rest of the module is very simple. As a small new feature for the website, we are using a lottery system that pulls six numbers from a block of 49 (plus a bonus number). It is possible and easy to adapt this to other lottery systems. Every user gets six randomly selected lottery numbers. That, however, does not happen every time, but with a probability...