Gossamer Forum
Home : General : Perl Programming :

Weird AOL problem...

Quote Reply
Weird AOL problem...
I have some script that checks the referer, and if it isn't from my site, it generates a page and an e-mail to me that says someone is trying to cheat. It works well, except for some reason, the AOL browser, or service, [Mozilla/4.0 (compatible; MSIE 4.01; AOL 4.0; Windows 98)] will always generate this call.
Does anyone know why, or, is code needed.

Thanks,
Derek
Quote Reply
Re: Weird AOL problem... In reply to
Without seeing the fields, can't help I'm afraid. =)

Cheers,

Alex
Quote Reply
Re: Weird AOL problem... In reply to
Ok, here is the code I used:

Code:
$let=$ENV{'HTTP_REFERER'};
$id=$ENV{'QUERY_STRING'};
@referers = ('http://www.djmixes.com','http://dance.djcafe.com','http://djmixes.com','http://www.dance.djcafe.com');

foreach $referer (@referers)
{
if ($let =~ /^$referer/i)
{
$found=1;

##do stuff if the referer matches

print "Location: $url \n\n";
exit;

}
}

if (found != 1){
##################################################################
## Capture users info for security and do a reverse DNS lookup
##################################################################
&rev_dns;
$new = "$ENV{'QUERY_STRING'}|$todaydate|$ENV{'REMOTE_HOST'}|$ENV{'REMOTE_ADDR'}|$ENV{'HTTP_REFERER'}|$ENV{'REMOTE_IDENT'}";

##################################################################
## Print an html file if the user linked from a url other than yours
##################################################################
print "Content-type: text/html\n\n";
print "
<html>
<head>
<meta http-equiv=\"Refresh\" content=\"20; URL=http://www.djmixes.com/\">
<title>ERROR: Anti-Leech Gateway</title>
</head>
<body bgcolor=\"#000000\" text=\"#C0C0C0\" link=\"#FFFFFF\" vlink=\"#FFFFFF\">
<center><font face=\"TAHOMA,VERDANA,arial,helvetica\" size=\"8\">ERROR: <font color=white>Anti-Leech</font></font></center>
<p>
<div align=\"center\"><!-- BEGIN RICH-MEDIA BURST! CODE -->
<a href=\"http://www4.burstnet.com/ads/ad4259a-map.cgi\" target=\"_blank\">
<img src=\"http://www4.burstnet.com/cgi-bin/ads/ad4259a.cgi\"
ismap width=468 height=60 border=0 alt=\"Click Here\"></a>
<!-- END BURST CODE -->
<p>
<center>
<table width=540 border=0>
<tr>
<td><font face=tahoma,verdana,arial,helvetica size=2>
You have followed a link from a site that is executing a script from outside the djmixes.com domain. The following information has been recorded and I will follow up with all would-be top 100 cheaters. <br>
Click <a href=\"http://www.djmixes.com/\">here</a> to get to the real site or you will be automatically sent there in 20 seconds<br>
<hr width=540><br>";
print"
<p>Link asked for: <b>$ENV{'QUERY_STRING'}</b>
<p>Your remote host: <b>$ENV{'REMOTE_HOST'}</b>
<p>Your remote address: <b>$ENV{'REMOTE_ADDR'}</b>
<p>Refering page: <b>$ENV{'HTTP_REFERER'} </b>
<p>Remote identity: <b>$ENV{'REMOTE_IDENT'}</b>
<p>Your browser and OS: <b>$ENV{'HTTP_USER_AGENT'}</b>
<br><br>
<hr width=540><center>Copyright © 1999 by: <a href=\"http://www.djmixes.com/\">Extremely Dance</a>, all rights reserved.</td></tr></table></center>
</font>
</body>
</html>";

##################################################################
## print the users info to a file
##################################################################
if ( -e "$path/data/xlink.txt") {
open (LOGFILE, ">>$path/data/xlink.txt") &#0124; &#0124; &error("Unable to open xlink.txt for writing");
print LOGFILE ("$new\n");
close(LOGFILE);
&send_email;
}
else{
open (LOGFILE, ">$path/data/xlink.txt") &#0124; &#0124; &error("Unable to open xlink.txt for writing");
print LOGFILE ("$new\n");
close(LOGFILE);
&send_email;
}

}

##################################################################
## send an email to inform webmaster of hotlinkers
##################################################################
sub send_email
{
&rev_dns;
open(MAIL,"|$mail_prog -t") &#0124; &#0124; &error("MAIL PROGGY $!");
print MAIL "To: $your_email\n";
print MAIL "From: $your_email\n";
print MAIL "Subject: Top 100 External Linker!\n";
print MAIL "The following site is externally linking:\n\n";
print MAIL "Link ID: $ENV{'QUERY_STRING'}\n";
print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n";
print MAIL "Remote address: $ENV{'REMOTE_ADDR'}\n";
print MAIL "Refering page: $ENV{'HTTP_REFERER'}\n";
print MAIL "Remote identity: $ENV{'REMOTE_IDENT'}\n";
print MAIL "Browser and OS: $ENV{'HTTP_USER_AGENT'}\n";
print MAIL"\n\n";
close (MAIL);
exit;

}

##################################################################
## print error messages
##################################################################
sub error{
$errors = $_[0] ;

print"<HTML><HEAD><TITLE>RA link script error</TITLE></HEAD><Body bgcolor=\"#000000\" text=\"#FFFFFF\"><center>";
print"<TABLE cellpadding=10 border=1 bgcolor=silver><TR><TD><center><font face=arial size=-1>RA link error has occured<BR>";
print"<b>The error is: <br><font size=+1 color=red>$errors -- $!</font><br><br>";
print"Please let us know of the error by e-mail at, <A HREF=\"mailto:$email\">$email</A><br><BR>";
print"</TD></TR></TABLE>";
exit;
}

##################################################################
## Reverse DNS lookup
##################################################################
sub rev_dns
{
if (($ENV{'REMOTE_HOST'} eq $ENV{'REMOTE_ADDR'})
&& ($ENV{'REMOTE_ADDR'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/))
{
$Address = pack('C4', $1, $2, $3, $4);
$DNS_Address = (gethostbyaddr($Address, 2))[0];
$ENV{'REMOTE_HOST'} = $DNS_Address if $DNS_Address;
}
}
Quote Reply
Re: Weird AOL problem... In reply to