#!/usr/bin/perl print "Content-type: text/html\n\n"; ######## REQUIRED FILES ########### require "cgi-lib.pl" || die "Error loading cgi-lib.pl"; require "db-common.sub" || die "Error loading db-common.sub"; $alertstable = "alerts"; $regtable = "registrations"; &Conn_to_DB; ###### Connect to bad emails database and get all the emails $SQL = "Select * from bademails ORDER BY ID DESC"; &Do_SQL; while ($pointer = $sth->fetchrow_hashref) { $bademail = $pointer->{'email'}; ###### Connect to alerts database and get the entries that match the bademail list $SQL2 = "Select * from $alertstable where email LIKE '%$bademail%'"; &Do_SQL2; while ($pointer2 = $sth2->fetchrow_hashref) { $item = $pointer2->{'jobtype'}; $alerttype = $pointer2->{'alerttype'}; $emaillist = $pointer2->{'email'}; $ID = $pointer2->{'ID'}; @emails = split /~~~/,$emaillist; @goodemails = (); foreach $address (@emails) { #print "$ID, $address
\n"; if ($address ne $bademail) { push @goodemails,$address; } } #end foreach $newlist=join('~~~',@goodemails); $SQL3 = "UPDATE $alertstable SET email='$newlist' WHERE jobtype='$item' and alerttype='$alerttype'"; &Do_SQL3; print "updated $ID, $elist
\n"; } #end while ($pointer2 = $sth2->fetchrow_hashref) { ###### Connect to reg database and set the alerts to nothing if it matches a bademail $SQL3 = "UPDATE $regtable SET alerts='$alerts' WHERE email='$bademail'"; &Do_SQL3; print "Reset Reg. ID: $ID, $bademail
\n"; } # end while $dbh->disconnect; exit;