A friend of mine from a long time ago wrote a perl script for me. It used to notify me via email when people from certain chosen domains visit my personal website.
The script still works but only for a single domain (pcisys.net). It no longer works when someone from comcast.net, qwest.net, et al visit my site unless I set it to look for something specific.
Code:
#!/usr/bin/perl
# notify.pl
# Mail notification when a visitor from a domain comes to mouse's site.
$RCP= 'notif@website.org';
$SBJ = 'visitor notification';
@STALKED = ('comcast.net', 'qwest.net', 'pcisys.net');
print "Content-type: text/plain\r\n";
print "\r\n";
$stalked_RE = '(' . join('|', @STALKED) . ')$';
exit unless $ENV{REMOTE_HOST} =~ /$stalked_RE/;
open(PP, "|/usr/sbin/sendmail -t") or die;
print PP <<"EOF";
To: $RCP
Subject: $SBJ
Dear mouse,
Hit from $ENV{REMOTE_HOST} via $ENV{HTTP_REFERER}.
EOF
close(PP);
Now I did change one property by adding wildcards in the hopes that the script would work as intended once again.
Code:
@STALKED = ('*.comcast.net', '*.qwest.net', 'pcisys.net');
But no dice.
Anyone have recommendations or suggestions? I know very little programming.