Dear xperts,
I built a form which when submitted:
1. Sends the content of the form to myself,
2. Sends an autoresponder to the site visitor,
3. Adds the visitors e-mail address to a txt file.
The problem with this is that when a customer uses the form more then once the same address is added to the txt file which results in some e-mail addresses being on the txt file more than once. I would like to add a piece of code which checks whether the e-mail is allready in the txt file, if it is then it doesn't add it and if it ain't it adds it.... Below is the current code that I use:
#!/usr/bin/perl
$|++;
use CGI;
$query = new CGI;
$fullname=$query->param('f
ullname');
$email=$query->param('emai
l');
$problem=$query->param('pr
oblem');
open(MAIL, "|/usr/sbin/sendmail");
print MAIL "From: $fullname<$email>\n";
print MAIL "To: support\@krooga.co.uk\n";
print MAIL "Subject: Customer needs help !!!\n";
print MAIL "\n";
print MAIL "Problem : $problem\n";
close MAIL;
open(MAIL, "|/usr/sbin/sendmail");
print MAIL "From: support\krooga.co.uk\n";
print MAIL "To: <$email>\n";
print MAIL "Subject: RE: Krooga support\n";
print MAIL "\n";
print MAIL "Thank you for contacting us at krooga.co.uk\n";
print MAIL "we have received your question/comment and\n";
print MAIL "are doing our very best to reply to you as soon\n";
print MAIL "as possible. Should you require an immediate\n";
print MAIL "answer please call or text 07751228685 ...\n";
print MAIL " \n";
print MAIL "The Krooga Team\n";
print MAIL "
http://www.krooga.co.uk\n";
close MAIL;
open (LIST, ">>/home/sites/
www.kragoo.co.uk/users/krooga/web/cgi-bin/maillist.txt");
print LIST "$email\n";
close (LIST);
print "Content-type: text/html\n\n";
open(HANDLE,"/home/sites/
www.kragoo.co.uk/users/krooga/web/redirect.htm") || print "Please goto
www.krooga.co.uk";
while(<HANDLE>) {
#$_=~s/graphics/..\/graphi
cs/g;
print $_;
}
While i'm at it is there any errors with the form ?
Thanks for your help,
Sam ;-)
sam@kragoo.co.uk
Start Free Trial