#!/usr/bin/perl # # Ultimate Bulletin Board is copyright Infopop Corporation, 1998-2000. # # ------------ ubbmail.cgi ------------- # # # Infopop Corporation offers no # warranties on this script. The owner/licensee of the script is # solely responsible for any problems caused by installation of # the script or use of the script, including messages that may be # posted on the BB. # # All copyright notices regarding the Ultimate Bulletin Board # must remain intact on the scripts and in the HTML # for the scripts. # # For more info on the Ultimate BB, # see http://www.UltimateBB.com # ############################################################### # #If you are running UBB on IIS, #you may need to add the following line #if so, just remove the "#" sign before the print line below #print "HTTP/1.0 200 OK\n"; eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows / ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \ #substitute all require files here for the file require "UltBB.setup"; require "Date.pl"; require "mail-lib.pl"; require "Styles.file"; require "ubb_library.pl"; require "ubb_library2.pl"; require "mods.file"; }; if ($@) { print ("Content-type: text/html\n\n"); print "Error including required files: $@\n"; print "Make sure these files exist, permissions are set properly, and paths are set correctly."; exit; } use Socket; &ReadParse; foreach $row(@in) { ($Name, $Value) = split ("=", $row); $Name = &decodeURL($Name); $Value = &decodeURL($Value); if ($Name eq "forum") { $Forum = $Value; $Forum =~ s/\/\\//g; $ForumCoded = &HTMLIFY($Forum); $ForumCoded =~ tr/ /+/; $Forum = &UNHTMLIFY($Forum); } if ($Name eq "Subject") { $Subject = $Value; $Subject =~ s/<.+?>//g; } if ($Name eq "UserName") { $UserName = $Value; $UserName = &UNHTMLIFY($UserName); $UserNameCoded = &HTMLIFY($UserName); $UserNameCoded =~ tr/ /+/; } if ($Name eq "Password") { $Password = $Value; $Password = &UNHTMLIFY($Password); $PasswordCoded = &HTMLIFY($Password); $PasswordCoded =~ tr/ /+/; } } # end FOREACH $row print ("Content-type: text/html\n\n"); if ($VariablesPath eq "") { $VariablesPath = $CGIPath; } #create random numbers for headers/footers $RandomNumber = &MakeRandomNumber; $RandomNumber2 = $RandomNumber + 100074; if ($Header ne "") { $Header =~ s/UBBrandomX/$RandomNumber/isg; $Header =~ s/UBBrandomY/$RandomNumber2/isg; } if ($Footer ne "") { $Footer =~ s/UBBrandomX/$RandomNumber/isg; $Footer =~ s/UBBrandomY/$RandomNumber2/isg; } #adjust bgcolor variables if ($BGColor ne ""){ $BGColor = qq(bgcolor="$BGColor"); } if ($AltColumnColor1 ne ""){ $AltColumnColor1 = qq(bgcolor="$AltColumnColor1"); } if ($AltColumnColor2 ne ""){ $AltColumnColor2 = qq(bgcolor="$AltColumnColor2"); } if ($CategoryStripColor ne ""){ $CategoryStripColor = qq(bgcolor="$CategoryStripColor"); } if ($TableColorStrip ne ""){ $TableColorStrip = qq(bgcolor="$TableColorStrip"); } if ($PageBackground ne ""){ $PageBackground = qq(background="$NonCGIURL/$PageBackground"); } if ($TableBorderColor ne ""){ $TableWidth2 = "100%"; $BorderTop = qq(
| ); $BorderBottom = qq( |
/\n\r\n/ig;
$message =~ s/<.+?>//g;
$Message = &ConvertReturns("$message");
if ($in{'start'} eq "0") {
$subject = $Subject;
$message = $in{'Message'};
$message =~ s/
/\n/ig;
$message =~ s/
/\n\r\n/ig;
$message =~ s/<.+?>//g;
$Message = &ConvertReturns("$message");
#print to file for record-keeping
unless (-e "$NonCGIPath/emaillog") {
mkdir ("$NonCGIPath/emaillog", 0777);
chmod(0777, "$NonCGIPath/emaillog");
}
&GetDateTime;
$EmailNumber = "$RunonDate$JSTime$sec";
open (EMAILLOG, ">$NonCGIPath/emaillog/$EmailNumber.cgi");
print EMAILLOG "$subject\n";
print EMAILLOG "$Message\n";
close (EMAILLOG);
chmod(0666, "$NonCGIPath/emaillog/$EmailNumber.cgi");
#print emaillist to file
&GetEmails;
foreach $thisline(@EmailList) {
chomp($thisline);
($sendto, $profnum) = split(/\?\?/, $thisline);
@profilestats = &OpenProfile("$profnum.cgi");
$AllowMassMail = $profilestats[14];
chomp($AllowMassMail);
if ($AllowMassMail ne "no") {
push(@emaillist, $sendto);
}
}
open (EMAIL, ">$NonCGIPath/emaillisttemp.cgi");
foreach $dos(@emaillist) {
chomp($dos);
print EMAIL "$dos\n";
}
close(EMAIL);
chmod(0666, "$NonCGIPath/emaillisttemp.cgi");
} else {
#open exiting email log file
$EmailNumber = $in{'EmailNumber'};
open (EMAILLOG, "$NonCGIPath/emaillog/$EmailNumber.cgi");
@thisemail = /\n\r\n/ig;
$message =~ s/<.+?>//g;
}
#get registered users
open (GETEMAIL, "$NonCGIPath/emaillisttemp.cgi");
@themembers =
We are emailing all registered users who allow such emails to be received.
We just emailed Members $StartDisplay to $EndDisplay...
$EmailLine
/\n/ig;
$message =~ s/
";
}
}
if ($EndLoop eq "true") {
$FinishWording = "We have finished emailing all eligible registered users.";
&FinishMail;
unlink "$NonCGIPath/emaillisttemp.cgi";
} else {
&ContinueMail;
}
} else {
&StandardHTMLCP("You have turned your email functions OFF in your control panel. You cannot use this feature unless EMAIL is turned ON in the general variables section of your control panel.");
exit;
} #id use email is not on
} #End Mail USers sr
sub ContinueMail {
print<