#!/usr/local/bin/perl # +-------------------------------------------+ # | recommend.cgi -- Script used to recommend | # | the web site to a group | # | of friends | # | | # | Author : Ryan William Facer | # | Created On : Tuesday July 14, 1998 | # | Completed on : Tuesday July 14, 1998 | # | Last Modified By : Ryan William Facer | # | Last Modified On : Monday July 20, 1998 | # | Update Count : 1 | # | E-Mail : cattails@cattails.ca | # +-------------------------------------------+ # | 1. Added new hidden fields to make the | # | script more modular. | # | 2. Now uses 'sendmail' instead of 'mail' | # +-------------------------------------------+ # $mailprog is the mail program used by the system # $mailprog = '/usr/sbin/sendmail'; # This might work too... $mailprog = '/usr/lib/sendmail'; # ****************************************************************** # Instructions # ****************************************************************** # This script requires an HTML page that prompts a user for their # 'Name' and 5 friends: 'Friend1' 'Friend2' etc. If the user # only has 3 friends and submits the script will still work fine. # Make sure you modify the $mailprog variable below as necessary. # The file /usr/bin/mail should be fine and the -s is to specify # a subject within double quotes. Change the subject as you see fit. # You may also want to change the body of the message down below. # ****************************************************************** # ******************************* # We include the cgi-lib.cgi file # ******************************* do "cgi-lib.cgi" || die "Content-type: text/plain\n\nError loading cgi-lib\n"; # ************************************************* # Now we call the subroutine in cgi-lib.cgi to read # in the variables from the form and set them up as # 'key'='value' pairs in the array @in # ************************************************* &ReadParse; open(MAIL,"|$mailprog -t"); print MAIL "To: $in{'Friend1'}\n"; print MAIL "To: $in{'Friend2'}\n"; print MAIL "To: $in{'Friend3'}\n"; print MAIL "From: $in{'EMail'} ($in{'Name'})\n"; print MAIL "Subject: $in{'Subject'}\n"; print MAIL "$in{'Name'} recommends that you visit $in{'Website'}\n"; print MAIL "$in{'Message_Standard'}"; print MAIL "\n"; print MAIL "Here's a message from $in{'Name'}:\n"; print MAIL "$in{'Message_User'}"; close (MAIL); print "Location: $in{'Goto'}\n\n";