ugnewscapture.cgi

 


#!/usr/bin/perl

require "subparseform.lib";
&Parse_Form;

print "Content-type: text/html\n\n";



($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdist)=localtime(time);
$mon = $mon + 1;
$mon = sprintf("%02d", $mon) if 
    $mon <= 9;
$mday = sprintf("%02d", $mday) if 
    $mday <= 9;
$min = sprintf("%02d", $min) if 
    $min <= 9;


$date=$year . $mon . $mday . $hour . $min . $sec;


###
### Change UNIX line feeds into HTML line feeds
###
$formdata{'topic'} =~ s/\n/<br>/g;
$formdata{'news'} =~ s/\n/<br>/g;
$ENV{'REMOTE_USER'} =~ s/\n/<br>/g;

###
### Format message into html
###
$xline = sprintf("<p><b>%s</b>  <br>%s/%s/2003 - %s:%s <br> %s <br>Submitted by: %s", $formdata{'topic'}, $mon, $mday, $hour, $min, $formdata{'news'}, $ENV{'REMOTE_USER'});

###
### Store message
###
open (FILENAME, ">>/news/newscapture.txt") || &ErrorMessage;
print FILENAME "$xline\n";
close (FILENAME);





###
### Send email
###
$subject = $formdata{'topic'};
$contents = $formdata{'news'};

###
### Send emails to everyone listed in /news/address.txt
###
$n=1;

open (ADDRESSES, "</news/addresses.txt") || &ErrorMessage;
@eaddresses = <ADDRESSES>;
close (ADDRESSES);

### print "<blockquote>Sending email message to...\n</blockquote>";

foreach $address (@eaddresses)
{
   ### print "<blockquote>$address\n</blockquote>";

   ###   print "<blockquote>Subject: $subject\n</blockquote>";
   ###   print "<blockquote>Contents: $contents\n</blockquote>";

   $n++;

   open (MAIL, "|/usr/sbin/sendmail -t") || &ErrorMessage;

   print MAIL "To: $address \nFrom: WWRC Bulletin\n";
   print MAIL "Subject: $subject\n";
   print MAIL "$contents\n";

   close (MAIL);

}







###
### Read in all messages
###
open (FILENAME, "</news/newscapture.txt") || &ErrorMessage;
@stories = <FILENAME>;
close (FILENAME);

$total=$#stories;





###
### Display messages
###

print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head>"; 

print "<TITLE>Women Who Really Cook</TITLE>"; 

print "<!-- The next two lines should be in every *.html file"; 
print "     that you want to have this style -->"; 

print "<META content=text/css http-equiv=Content-Style-Type>"; 
print "<LINK href=\"http://www.setgetweb.com/wendy/women/mstyle.css\" rel=\"stylesheet\" type=\"text/css\">"; 

print "</HEAD>"; 


print "<BODY BACKGROUND=\"http://www.setgetweb.com/wendy/women/img/bg.jpg\">"; 

print "<TABLE BORDER=\"0\" WIDTH=\"100%\" ALIGN=\"left\">"; 
print "<TR><TD VALIGN=\"top\">"; 

print "<TABLE BORDER=\"0\" WIDTH=\"570\" CELLPADDING=\"0\" CELLSPACING=\"0\">"; 
print "<TR><TD>"; 
print "<IMG SRC=\"http://www.setgetweb.com/wendy/women/img/logo3.jpg\" BORDER=\"0\"></IMG>"; 
print "</TD></TR>"; 

print "<TR><TD>";
print "<TABLE WIDTH=570 CELPADDING=0 CELLSPACING=0 BGCOLOR=silver>";
print	"<TR>";
print	"<TD WIDTH=60 ALIGN=CENTER><A HREF=\"http://www.setgetweb.com/wendy/women/index.html\">Home</A></TD>";
print	"<TD WIDTH=100 ALIGN=CENTER><A HREF=\"http://www.setgetweb.com/wendy/women/membersonly.html\">Members Only</A></TD>";
print	"<TD WIDTH=135 ALIGN=CENTER><A HREF=\"http://www.setgetweb.com/wendy/women/becomemember.html\">Become a Member</A></TD>";
print	"<TD WIDTH=65 ALIGN=CENTER><A HREF=\"http://www.setgetweb.com/wendy/women/recipes.html\">Recipes</A></TD>";
print	"<TD WIDTH=60 ALIGN=CENTER><A HREF=\"http://www.setgetweb.com/wendy/women/photos.html\">Photos</A></TD>";
print	"<TD WIDTH=81 ALIGN=CENTER><A HREF=\"http://www.setgetweb.com/wendy/women/contact.html\">Contact Us</A></TD>";
print	"<TD WIDTH=69 ALIGN=CENTER><A HREF=\"mailto:qp@visi.com\">Webmaster</A></tD>";
print	"</TR>";

print "</TABLE>"; 
print "<BR CLEAR=\"all\">"; 
print "</TD></TR>"; 


print "<TR><TD>"; 
print "<TABLE BORDER=\"0\" WIDTH=\"570\">"; 
print "<TR><TD WIDTH=\"150\" VALIGN=top>"; 


print	"<TABLE WIDTH=140 CELPADDING=0 CELLSPACING=2>";
print	"<TR HEIGHT=20><TD WIDTH=130 BGCOLOR=#FFCCCC ALIGN=LEFT><A HREF=\"http://www.setgetweb.com/cgi-bin/news1.cgi\">Bulletin Board</A></TD></TR>";
print	"<TR HEIGHT=20><TD WIDTH=130 BGCOLOR=#FFCCCC ALIGN=LEFT><A HREF=\"http://www.setgetweb.com/wendy/women/members/bulletin.html\">Post New Message</A></TD></TR>";
print	"<TR HEIGHT=20><TD WIDTH=130 BGCOLOR=#FFCCCC ALIGN=LEFT><A HREF=\"http://www.setgetweb.com/wendy/women/members/2003/enews.html\" TARGET=_blank>e-Newsletter</A></TD></TR>";
print	"<TR HEIGHT=20><TD WIDTH=130 BGCOLOR=#FFCCCC ALIGN=LEFT><A HREF=\"http://www.setgetweb.com/wendy/women/members/dir/372845directory.html\">Member Directory</A></TD></TR>";
print	"</TABLE>";

print "</TD>"; 

print "<TD WIDTH=\"420\">"; 





for ($i = $total; $i > 0; --$i) {
	print "$stories[$i]";
}





print "</TD></TR>";
print "</TABLE>";


print "	</TD></TR>";
print "	</TABLE>";
print "	</CENTER>";



print "</BODY>";
print "</HTML>";



 sub ErrorMessage {
 	print "Content-type: text/html\n\n";
 	print "The server can't process file. It either doesn't exist or the permissions are wrong. \n";
 	exit;
 }