Using this line of procmail to forward data to a perl script:
FROM=`formail -rt -xTo:`
:0
* ^TOsubscribe-req(_at_)flagfootball(_dot_)com
| perl $HOME/www/cgi/elistmgr/conf_req.pl $FROM
When I run this script, I get noooothing. Any
ideas?
#!/usr/bin/perl -w
#######################################################################
# #
# SCRIPT: conf_reqDB.cgi (c) 1998, Jeffrey L. Fitzgerald #
# #
# VERSION: 1.0 / 03-20-98 ORIGINAL RELEASE: 03-20-98 #
# #
#######################################################################
#
#
##################################
# Required Variables #
##################################
require "../lib-pl/mail-lib.pl";
##################################
# Required Modules #
##################################
use Mysql;
#######################################################################
# > MAIN #
#######################################################################
&logscript ("##### Starting conf_reqDB.cgi...");
$from = $ARGV[0];
&logscript ("Var passed from message:$from");
while (<STDIN>) {
if ($_ =~ /^Subject: +OK/i) {
&logscript ("Match Found on Subject: OK / $from");
&insert_dbdata;
exit(0);
} else {
&logscript ("Match FAILED! OK / $from");
exit(0);
}
}
&logscript ("##### Script Ended.");
#######################################################################
# > SUBROUTINE InsertDBdata #
#######################################################################
sub insert_dbdata {
&logscript ("Attempting mySQL Database Connect...");
$dbh=Mysql->connect('sql','flagfootball.com');
if ($dbh) {
&logscript ("Connected to Database!");
$from =~ s/\'/\\'/;
$from =~ s/\@/\\@/;
$result = $dbh->query ("INSERT INTO ffc_newslist VALUES
(\'$from\')") ;
} else {
&logscript ("Database Connect FAILED!");
exit(0);
}
}
#######################################################################
# > SUBROUTINE Log Script #
#######################################################################
sub logscript {
local($linedata) = @_;
open (LOG,">>log.data") || die "Nothing works around here...";
print LOG ")>$linedata\n";
close(LOG);
}