EMAIL CONTEST ------------- Contest.pl is an email contest manager that sits in the .forward file of dedicated contest user email address (very much like your typical vacation program). It's designed to accept emails that have been sent from a website contest and enter the results in a contest database. FEATURES --------- 1. Confirm first time email entries with a challenge email response 2. Multiple contest config files (run many contests through the same email at the same time) 3. Fully configurable subject/messages for every response 4. Sophisticated conditional text substitution in email responses 5. Configurable entry results data (answers) 6. Configurable entry results testing (correct answer) 7. Automatic winner pick (random or first correct) 8. Multiple winners 9. Loser notification 10. Configurable contest end date 11. Configurable contest announce date 12. Contest Database access enclosed in an easily replacable package 13. Black list testing of entries 14. Check for mailer daemons and other automated responses REQUIREMENTS ------------ Perl 5.005 or above Time::Local Data::Dumper Mail::Mailer DB_File INSTALL CONTEST --------------- The latest released or current version is available at http://www.littlefish.ca/projects/contest 1. copy the contest-X.XX.tgz file to your local sbin and unpack the archive. for example: download to /usr/local/sbin/contest-X.XX.tgz cd /usr/local/sbin tar -zxvpf contest-X.XX.tgz 2. move the default config file to /etc/contest.conf mv contest.conf /etc/contest.conf 3. edit the default config The config file documentation can be found in: contest.conf.help. Read it through to decide what needs changing. While you can run contest.pl using just the default config file, you'd be better off to create separate config files for the contest user itself. See the sample.conf file included in this archive. 4. That's it! You're done! SETUP A CONTEST --------------- The contest operation is similar to the vacation utility. 1. choose a user. This user will receive and reply to all contest entries 2. copy the /etc/contest.conf to the user home directory. Delete anything that doesn't change for this user. The local contest.conf values will over-ride the default /etc/contest.conf values. (this step is optional) 3. create a contest config file in the user home directory See the contest.sample.conf file. The contest config file must have a name of: contest.X.conf where 'X' is the contest number (any number of digits). The contest config file must exist to run a contest. Edit the contest config file according to your contest requirements (same format as the default config file). 4. test the contest user From the command line run (preferably as the contest user): /usr/local/sbin/contest.pl -c contest.conf -C -u {username} You should see a number of consistency check message. If there were no errors, a number of database files (files ending in '.db') should have been created in the user home directory, with the user's user id and group id. 5. edit the ~user/.forward file and add this line: | /usr/local/sbin/contest.pl -c contest.conf -l messages.log username 6. send a message to this user to test the contest The '-c contest.conf' is optional. If you don't plan to run more than one contest, it's probably just as well that you skip it. ACCEPT ENTRIES FROM A WEBPAGE ----------------------------- This is an example of a PHP web page script that will accept and send contest entries. To use it, simply cut and past this code on to your webpage and customize as required. The web server must be enabled to run PHP scripts: The contest entry is incomplete

Please fill all the required fields

"; } elseif (!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { echo "

The contest entry is incomplete

The email address is invalid

"; } elseif (mail($receiverMail, $subject, $msgbody, "From: $name <$email>")) { echo "

Your entry has been sent!

Contest details to follow.

"; } else { echo "

There was a problem with your entry

Please try again... If the problem continues there's probably something wrong with the server.

"; } } else { print <<
END; } ?> UNFINISHED ---------- This readme really needs more stuff here :) 10/13/2003 projects.AT.littlefish.ca