by outaline » Mon Mar 12, 2007 5:43 pm
OK. I am a glutton for punishment. The thing is that the person that will be manually adding subscribers won't have FTP access so a web based option will work better.
I added the query thingamajiggy in the right spot I think and I now actually get to the page where I can add subscribers but after I click add nothing happens. I feel like I am so close yet so far. I deleted the sql and banned stuff, although I wasn't sure about the $FORM{'list'} part. Could you take a peek at it when you get a spare moment?
######################################################################
# ADD SUBSCRIBERS
######################################################################
# SUB ADD_SUBS : SCREEN TO ADD SUBSCRIBERS
####
sub add_subs {
print <<ENDofHTML;
<HTML>
<head><title>Admin :: Add Subscribers</title></head>
$header
<center><font size=+2><b><u>Add Subscribers</u></b></font></center>
<p align="justify">Here you can add subscribers to your subscribers.txt file. Each address must be seperated by a newline (no commas, semicolons, colons, intestines, or spaces!), just like the subscribers.txt file itself. These addresses are added automatically (the addresses will not have to be confirmed).</p>
<form action="$script" method="POST">
<textarea name="subs" cols=50 rows=15></textarea><BR><BR>
Do you want your subscribers to be subscribed as HTML or plain text subscribers?
<select name="html"><option>Plain Text</option><option>HTML</option></select><BR><BR>
<input type="hidden" name="action" value="add_subs">
<input type="Submit" name="Submit" value="Add">
</form>
<center><FORM ACTION="$script?testpass" METHOD="POST"><INPUT TYPE="hidden" NAME="password" value="$pass"><input type="hidden" name="list" value="ADD"><input type="submit" name="action" value="BACK TO ADMIN"></FORM></CENTER>
$footer
</body></html>
ENDofHTML
}
# SUB ADD_SUBS2 : ACTUALLY ADDS SUBSCRIBERS
####
sub add_subs2 {
$FORM{'subs'} =~ s/\r//g;
@subs = split(/\n/,$FORM{'subs'});
SUB_CHECK: foreach $sub(@subs) {
if ($sub =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(,)/ || $sub !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/) {push(@bad_format,$sub); next SUB_CHECK;}
# CHECK FOR ALREADY SUBSCRIBED
{
open(SUBS,"subscribers.txt");
@current_subs = <SUBS>;
close(SUBS);
foreach $current_sub(@current_subs) {
@subber = split(/ :: /,$current_sub);
if ($sub eq "$subber[0]") {push(@already_subscribed,$subber[0]); next SUB_CHECK;}
}
}
}
if ($FORM{'html'} eq "HTML") {$html = "1";}
else {$html = "0";}
# TEXT FILE
{
open(SUBS,"subscribers.txt") || die "can't open susbcribers.txt... WHAT???";
foreach $subscriber(@to_add) {
@nums = qw(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z);
$newcode0 = int(rand(@nums));
$newcode1 = int(rand(@nums));
$newcode2 = int(rand(@nums));
$newcode3 = int(rand(@nums));
$newcode4 = int(rand(@nums));
$newcode5 = int(rand(@nums));
$newcode6 = int(rand(@nums));
$newcode7 = int(rand(@nums));
$newcode8 = int(rand(@nums));
$newcode9 = int(rand(@nums));
$newcode = "$newcode0$newcode1$newcode2$newcode3$newcode4$newcode5$newcode6$newcode7$newcode8$newcode9";
print SUBS "$subscriber :: $newcode :: $html :: :: :: :: :: :: ";
@time = localtime;
print SUBS "@time";
print SUBS "\n";
}
close(SUBS);
}
&req;
print <<ENDofHTML;
<HTML>
<head><title>Admin :: Addresses Added</title></head>
$header
<center><font size=+2><b><u>Addresses Added</u></b></font></center>
ENDofHTML
print "<p>The following addresses have been subscribed to <b>$listname</b>:";
foreach $address(@to_add) {print "<li type=square>$address</li>";}
if (@already_subscribed) {print "</p><p>The following addresses were already subscribed so they weren't added:";
foreach $address(@already_subscribed) {print "<li type=square>$address</li>";}}
if (@bad_format) {print "</p><p>The following addresses aren't formatted correctly and weren't added :</b>";
foreach $address(@bad_format) {print "<li type=square>$address</li>";}}
if (@old_subscribers) {print "</p><p>These are addresses of previous subscribers, so they weren't added:</b>";
foreach $address(@old_subscribers) {print "<li type=square>$address</li>";}}
if (@banned_subs) {print "</p><p>The following addresses are banned from subscribing:</b>";
foreach $address(@banned_subs) {print "<li type=square>$address</li>";}}
if (@banned_domains) {print "</p><p>The following addresses contain banned domains:</b>";
foreach $address(@banned_domains) {print "<li type=square>$address</li>";}}
print <<ENDofHTML;
</p>
<center><FORM ACTION="$script?testpass" METHOD="POST"><INPUT TYPE="hidden" NAME="password" value="$pass"><input type="hidden" name="list" value="ADD"><input type="submit" name="action" value="BACK TO ADMIN"></FORM></CENTER>
$footer
</body></html>
ENDofHTML
}
######################################################################
# END ADD SUBSCRIBERS
######################################################################