= "4.2.0") {
extract($_SERVER);
}
?>
Caught!
A Catch!
Hello
You are now blocked from this site
This is due to abuse by your IP address or because you are a bot that is known to cause abuse. This file is listed as disallowed in robots.txt. If you are a bot you have disregarded this and are now blocked. If you are a human please contact the site administrator
\n");
while ($line = fgets($fp,255))
{
$u = explode(" ",$line);
if (ereg($u[0],$REMOTE_ADDR)) {$badbot++;}
}
fclose($fp);
if ($badbot == 0)
{ /* A new bot! */
/* send a mail to hostmaster */
$tmestamp = time();
$datum = date("Y-m-d (D) H:i:s",$tmestamp);
$from = "spamcatcher@yoursite";
$to = "you@yoursite.com";
$subject = "[SPAM BOT ALERT] Spam bot caught";
$msg = "A bad robot hit $REQUEST_URI on $datum \n";
$msg .= "The IP Address is $REMOTE_ADDR and the user agent is $HTTP_USER_AGENT\n";
mail($to, $subject, $msg, "From: $from");
/* add bot to blacklist: */
$fp = fopen($filename,'a+');
fwrite($fp,"$REMOTE_ADDR - - [$datum] \"$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL\" $HTTP_REFERER $HTTP_USER_AGENT\n");
fclose($fp);
/* add ip address to htaccess file */
$fp = fopen($htaccess,'a+');
fwrite($fp,"deny from $REMOTE_ADDR\n");
fclose($fp);
/* add to access log file */
$forbidden = "../forbidden.html";
$fp = fopen($forbidden,'a+');
$td1 = "";
$td2 = " | ";
$tr1 = "";
$tr2 = "
";
fwrite($fp,"$tr1 $td1 [$datum] $td2 $td1 $REMOTE_ADDR $td2 $td1 \"$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL\" $td2 $td1 $HTTP_REFERER $td2 $td1 $HTTP_USER_AGENT $td2 $tr2 \n");
fclose($fp);
}
?>