#!/usr/bin/perl require "/cgi-bin/cgi-lib.pl/"; require "domo.setup"; ####################################################### # This is the script that does the actual mailing. # # Kevin Meltzer 2/11/97 # ####################################################### print &PrintHeader; &ReadParse; $user_pass = $in{'password'}; $user_name = $in{'user_name'}; ########################################## # Check user/password first ########################################## &auth; ########################################### # Subroutine to send the mass mailing ########################################### sub do_mail { $BODY = $in{'letter'}; open(FILE, "$EMAIL_LOG"); @FILE = ; close(FILE); $ADDIES = join('',@FILE); @addies = split(/$DELIMITER/,$ADDIES); foreach $RECIP (@addies) { open(MAIL, "|$mailprog -t") || die "Can't open $mailprog"; print MAIL "TO: $RECIP\n"; print MAIL "FROM: $from\n"; print MAIL "SUBJECT: $mail_subj\n\n"; print MAIL "Date: $date\n\n"; print MAIL "$list_name\n\n"; print MAIL "$BODY"; close (MAIL); } print "Mail sent to:\n
"; $many = 0; foreach $RECIP (@addies) { $many++; print "$RECIP\n
"; } print "Total Recipients: $many"; } # end do_mail ############################################ # Subroutine to do authentication ############################################ sub auth { $user_match = 0; $pass_match = 0; open (USER, "$USERFILE") || die "Can't open $USERFILE"; while () { chop ($_); ($password, $username) = split(/\|/, $_); if ($user_name eq $username) { $user_match = 1; } if (&CryptPass ($user_pass, $password) eq $password) { $pass_match = 1; } } # end of while close (USER); } # Both name and password match, so send the mail if ($user_match eq 1 && $pass_match eq 1) { &do_mail; } # Password and/or user name are wrong. Does not return to user which is wrong. # This is for security reasons. if ($user_match eq 0 || $pass_match eq 0) { &no_access; } ############################################### # Subroutine to print out the no access page ############################################### sub no_access { print "\n"; print "No Access\n"; print "
Make your own free website on Tripod.com
\n"; print "

No Access

\n"; print "
You entered an incorrect password and/or user name to send this mailing.
\n"; print "\n"; print "\n"; exit; } ############################################### # Subroutine to check the encryption ############################################### sub CryptPass { local ($field, $salt) = @_; $field = crypt ($field, $salt); $field; } # End