robots.txt
Code
Disallow: /btra

/btra/index.php
Code
<?php
	if(phpversion() >= "4.2.0") {
		extract($_SERVER);
	}
?>
<html>
<head>
	<title>Bad Bot!</title>
</head>
<body>
<span style="font-weight: bold;">There is nothing here to see. So what are you doing here?</span><br />
<a href="../">Go home</a><br />
<?php
	$badbot = 0;

/* scan the blacklist.dat file for addresses of SPAM robots to prevent filling it up with duplicates */
	$filename = "../blacklist.dat";
	$fp = fopen($filename, "r") or die ("Error opening file ... <br />\n");

	while ($line = fgets($fp,255)) {
		$u = explode(" ",$line);
		if(ereg($u[0],$REMOTE_ADDR)) { $badbot++; }
	}
	fclose($fp);

	if ($badbot == 0) {
/* we just see a new bad bot not yet listed ! */
/* send a mail to hostmaster */
		$tmestamp = time();
		$datum = date("Y-m-d (D) H:i:s",$tmestamp);
		$from = "badbot-watch@domain.tld";
		$to = "hostmaster@domain.tld";
		$subject = "domain-tld alert: bad robot";
		$msg = "A bad robot hit $REQUEST_URI $datum \n";
		$msg .= "address is $REMOTE_ADDR, agent is $HTTP_USER_AGENT\n";
/* See, I don't want mail; so lets disable it...
		mail($to, $subject, $msg, "From: $from");
*/
/* append bad bot address data to blacklist log file: */
		$fp = fopen($filename,'a+');
		fwrite($fp,"$REMOTE_ADDR - - [$datum] \"$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL\" $HTTP_REFERER $HTTP_USER_AGENT\n");
		fclose($fp);
	}
?>
</body>
</html>

blacklist.dat (chmodded 777); a blank file (for now)

blacklist.php (include on every page to block users defined in blacklist.dat)
Code
<?php
	if(phpversion() >= "4.2.0") {
		extract($_SERVER);
	}

	$badbot = 0;

/* look for the IP address in the blacklist file */
//	$filename = "$_SERVER["DOCUMENT_ROOT"]/blacklist.dat";
	$filename = "blacklist.dat";
	$fp = fopen($filename, "r") or die ("Error opening file ... <br />\n");
	while ($line = fgets($fp,255))  {
		$u = explode(" ",$line);
		if (ereg($u[0],$REMOTE_ADDR)) {$badbot++;}
	}
	fclose($fp);

	if ($badbot > 0) {
/* this is a bad bot, reject it */
		sleep(20);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
	<title>You've been Blocked</title>
</head>
<body>

<div align="center">
<h1>Welcome...</h1>
Unfortunately, due to abuse, this site is not available to you.<br />
If you feel that your ban is in error, please send an email to the hostmaster of this site,<br />
If you're an anti-social, ill-behaving SPAM bot, please just go away.
</div>

</body>
</html>
<?php
		exit;
	}
?>



I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!