eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
radical hacks
LqidSkin's Multiple Choice Mailer Hack  
This readme instructions is for Selena Sol's Multiple Choice Questionaire. This script is already awsome, but I wondered what good is a test if you can't see the results of people taking it? There was only two ways you could check to see how good people were doing, one to take the test yourself and look at the results generated by the script. Two, you had to download the results file and read it, YUK!

Well good Old LqidSkin has added a mail function to the main script. So lazy people like me can sit on their butts and just read the results in an easy format everytime the test is taken!

What does it do excatly?

It mails all of the form fields specified, and the results of the test taken to the admin of the script.

Is it hard to configure?

Well not really, I suggest that you have some basic PERL knowlege before you attempt to edit.

Ready? Let's begin!

Along with the excisting variables to edit there are some new ones, they are as follows.

1: Line 40: $mailprog = '/usr.sbin/sendmail'; This variable points to the sendmail on your server.

2: Line 41: $recipient = 'you@yourdomain.com'; This variable is your e-mail address. This is where the report cards are sent.

3: Line 42: $mail = 1; This variable allows you to turn on/off the mail function. Set to 1 is on, set to 0 is off.

4: Starting at Line 228:

print RESULTS "$number_of_correct_answers\|";
print RESULTS "$form_data{'name'}\| $form_data{'email'}\| $form_data{'field_name'}\| $form_data{'field_name'}\| $form_data{'field_name'}\| $form_data{'field_name'}\| $form_data{'field_name'}\| $form_data{'field_name'}\| $date\n";
close (RESULTS);

This section is where you would add the extra form fields to write to the database, by default the only information writen are the name and email, just append all the extra fields you want in the same manor. BE SURE to insert the field names as they appier on your form! UNIX is case sensitive, this is an easy place to mess up, so pay close attition.

5: Starting Line 394

# Mail Option
if ($mail eq '1') {
# $recipient MUST not be defined by user input!!!!!!
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
print MAIL "Reply-to: Do_Not_Reply\n";
print MAIL "From: Lqid_bot\n";
print MAIL "Subject:Final Exam Taken\n\n";
print MAIL "You have had your Final Exam Accessed:\n\n";
print MAIL "------------------\n";
print MAIL "Data Below\n\n";
print MAIL "Email Address: $form_data{'email'}\n\n";
print MAIL "Score: $number_of_correct_answers out of $total_number_of_questions answered correctly\n\n";

if ( $form_data{'name'} ){
print MAIL "Client Name: <$form_data{'name'}>\n\n";

print MAIL "\n";
if ( $form_data{'client_address'} ){
print MAIL "Field Name:$form_data{'field_name'}\n\n";

if ( $form_data{'field_name'} ){
print MAIL "Field Name: $form_data{'field_name'}\n\n";

if ( $form_data{'field_name'} ){
print MAIL "Field Name: $form_data{'field_name'}\n\n";

if ( $form_data{'field_name'} ){
print MAIL "Field Name: $form_data{'field_name'}\n\n";

if ( $form_data{'field_name'} ){
print MAIL "Field Name: $form_data{'field_name'}\n\n";

if ( $form_data{'field_name'} ){
print MAIL "Field Name: $form_data{'field_name'}\n\n";

print MAIL "---------\n";

close (MAIL);

This section is where you would enter the same form field names as you did in the previous section, to be sent to your e-mail. As you read through this section, wherever you see "Field_name" Or "Field Name" enter your information just like you did in the previous variable. You can adjust the Reply-to, From and Subject lines as you see fit.

Another note: You can add as many extra fields you want here as well, just cut and paste one of the "if" statments and go to it!

If you have any problems just drop a note to I will be happy to give you a hand :o)

Read the script as a whole