Hi
Basically this purchased (no support from seller) script adds to a log every time a external web link is clicked from within my site and it is meant to send an email to the owner of that web link.
The logging part works ok, but I cannot get it to send out the email.
There is an admin page where the links and their corresponding email addresses are entered.
There are a number of files that make up the script and there live in a folder called tracker within the cgi-bin.
I've checked with my remote web hosting company and they tell me my sendmail address has to be linked to one of my email accounts for security, so I end up with this as some of the lines in the config.pl file -
Code:
$mailprog = qq|/usr/sbin/sendmail -fwebmaster@mydomainname.com|;
$myemail = qq|webmaster\@mydomainname.com|;
The code below is the last bit of code in the tracker.cgi file and I think it refers to the sendmail of the clicked links part?
Code:
my @pre = map { [$_, split /\|/ ] } @users2;
my @post = sort custom @pre;
@users2 = map { $_->[0] } @post;
@users2=reverse(@users2);
sub custom {
$a->[3] <=> $b->[3];
}
}
sub emailsite
{
$checkemail=$_[0];
$checkemail=~s!^www\.!!i;
open (FILE2,"<email_list") || print "cannot open file";
flock(FILE2, 2) ;
@emails = <FILE2>;
flock(FILE2, 8) ;
close (FILE2);
foreach $emails(@emails)
{
chomp $emails;
($site,$siteemail)=split(/\|/,$emails);
if ($refurl ne "no referrer information")
{$theref = "The link was clicked from: $refurl";}
if ($site eq $checkemail)
{
open (MAIL,"|$mailprog -t") || print "";
print MAIL "To: $siteemail\n";
print MAIL "From: $myemail\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$body\n\n";
print MAIL "Link clicked: http://$checkemail\n";
print MAIL $theref;
print MAIL "\n\n";
close (MAIL);
}
}
}
If anyone could shine any light to what could be the problem, it would be very much appreciated, as I've been trying to get this to work for a couple of weeks now and it's driving me crazy!
Many thanks, Happy100.
|