Viewing file: index.cgi (3.95 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
use English;
$datafile = 'approved.txt'; $rejection = 'rejection.txt';
if ($ENV{'REQUEST_METHOD'} ne 'POST') {
open (DATAFILE, "$datafile"); @datafile = <DATAFILE>; close (DATAFILE);
open (REJECTION, "$rejection"); @rejection = <REJECTION>; close (REJECTION);
print <<EOF; Content-Type: text/html
<HTML> <HEAD> <TITLE>Mail Controls</TITLE> </HEAD> <BODY> <CENTER> <H1>Approved Correspondents</H1> <TABLE><TR><TD> <PRE> 1. Put in an individual e-mail address, or 2. Put in a company URL with the \@ sign in front if you want to approve mail from everybody there (but don't put in a large company that the public uses like \@yahoo.com), and 3. Don't put in mailing lists like Yahoo Groups unless their e-mails always come from the same address. If they don't, contact Bill Choisser about them.
<U>Examples:</U>
bestfriend\@aol.com \@myemployer.com
<U>Your present list:</U>
EOF ; foreach $lineofdata (@datafile) { print "$lineofdata"; } print <<EOF;
<U>Revise it here:</U> </PRE> </TD></TR><TR><TD> <FORM METHOD="POST" ACTION="index.cgi"> <TEXTAREA COLS="50" ROWS="16" NAME="FileContent"> EOF ;
open (TEXTBODY, "$datafile") || die; $line = <TEXTBODY>; while ($line ne "") { print ($line); $line = <TEXTBODY>; } close (TEXTBODY2); print <<EOF; </TEXTAREA> </TD></TR></TABLE> <P> <INPUT TYPE="submit" VALUE="REVISE LIST"> </FORM> <P> <HR WIDTH="75%"> <P> <H1>Rejection E-mail</H1> <TABLE><TR><TD> <PRE> <U>Your present message:</U>
EOF ; foreach $lineofdata (@rejection) { print "$lineofdata"; } print <<EOF;
<U>Revise it here:</U> </PRE> </TD></TR><TR><TD> <FORM METHOD="POST" ACTION="rejection.cgi"> <TEXTAREA COLS="70" ROWS="16" NAME="FileContent"> EOF ;
open (TEXTBODY2, "$rejection") || die; $line = <TEXTBODY2>; while ($line ne "") { print ($line); $line = <TEXTBODY2>; } close (TEXTBODY2); print <<EOF; </TEXTAREA> </TD></TR></TABLE> <P> <INPUT TYPE="submit" VALUE="REVISE MESSAGE"> </FORM> <P> <HR WIDTH="75%"> <P> <H1>Open Spam Gate</H1> <TABLE><TR><TD> <PRE> You can turn off all filtering except virus filtering for five minutes by clicking below.
Some sites will e-mail you back immediately with a password or other information automatically right after you click on their web page or send them an e-mail. These responses often come from an address you won't know. That is why this feature is handy to have. You should click on this page a few seconds before you click on their site or otherwise initiate their automated e-mail. </PRE> <FORM ACTION="spamgate.cgi" METHOD=GET> <CENTER> <INPUT TYPE="submit" VALUE="OPEN SPAM GATE"> </CENTER> </FORM> </PRE> </TD></TR></TABLE> </CENTER> </BODY> </HTML> EOF ; exit; }
read (STDIN, $FormDataString, $ENV{'CONTENT_LENGTH'}); @FormDataArray = split(/&/,$FormDataString); for ($n=0; $n<=$#FormDataArray; $n++) { $FormDataArray[$n] =~ s/\+/ /g; #turn plusses into spaces $FormDataArray[$n] =~ s/%(..)/pack("c",hex($1))/ge; #turn hexed into ascii %FormDataHash = (%FormDataHash, (split /\=/,$FormDataArray[$n],2)); } $filecontent = $FormDataHash{'FileContent'}; $filecontent =~ tr/<>/()/; $filecontent =~ s/\x0D//g; $filecontent =~ tr/A-Z/a-z/; $filecontent =~ s/[\t\ ]//g; @filecontents = split(/\n/,$filecontent); @filecontents = sort(@filecontents); open (DATAFILE, ">$datafile"); foreach $line (@filecontents) { next if ($line eq $lastline); if ($line =~ /^[a-z0-9\-\_\/\&\+\.]*\@([a-z0-9\-]*\.)+[a-z]+$/) { print DATAFILE "$line\n"; $lastline = $line; } } close (DATAFILE);
print <<EOF; Content-Type: text/html
<HTML> <HEAD> <TITLE>Revision Completed</TITLE> </HEAD> <BODY> <CENTER> <H1>Revision Completed</H1> <BIG><A HREF="./">Check your work!</A></BIG> <P> (You may need to "reload" or "refresh" to see it.) </CENTER> </BODY> </HTML> EOF ; exit;
sub errmsg { $ErrString = @_[0]; print <<EOF; Content-Type: text/html
<HTML> <HEAD> <TITLE>Revise Document</TITLE> </HEAD> <BODY> $ErrString </BODY> </HTML> EOF ; exit; }
|