svn: /web/php/trunk/manual/ add-note.php include/spam-func.php
| From: | Daniel P. Brown | Date: | Tue, 27 Apr 2010 16:05:25 +0000 |
| Subject: | svn: /web/php/trunk/manual/ add-note.php include/spam-func.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-8001@lists.php.net to get a copy of this message | ||
danbrown Tue, 27 Apr 2010 16:05:25 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=298665
Log:
Hard-coded blacklisting. Done especially for repetitive useless submissions and abuse by the likes
of 'kate@example.com' today.
Changed paths:
U web/php/trunk/manual/add-note.php
A web/php/trunk/manual/include/
A web/php/trunk/manual/include/spam-func.php
Modified: web/php/trunk/manual/add-note.php
===================================================================
--- web/php/trunk/manual/add-note.php 2010-04-27 13:59:05 UTC (rev 298664)
+++ web/php/trunk/manual/add-note.php 2010-04-27 16:05:25 UTC (rev 298665)
@@ -1,6 +1,40 @@
<?php
// $Id$
+/**
+ * Before we even bother to initilize this script, let's
+ * see if this is a submission by an IP known to send SPAM.
+ * If so, admonish them and halt execution. 27-APR-2010 <danbrown>
+ */
+include dirname(__FILE__).'/include/spam-func.php';
+if (kill_spammer($_SERVER['REMOTE_ADDR']) !== false) {
+ echo " <center>
+ h1>WHOA!</h1>
+
+ Enough is enough, pal. All you do is make
+ our jobs and lives more difficult with your
+ constant reposting of SPAM and/or useless
+ material. And you know what? We're sick of
+ it! Consider yourself blacklisted from ever
+ posting here again.<br />
+ <br />
+
+ Think this is some kind of joke? It's not.<br />
+ <br />
+
+ Think this is some kind of mistake? Well, if you
+ haven't been submitting junk to the site, submit
+ this as a bug at <a href=\"http://bugs.php.net/\">http://bugs.php.net/</a>
+ with the following message:<br />
+ <br />
+
+ <i>Improper Blocking:
".strrev(str_replace('.','-',$_SERVER['REMOTE_ADDR']))."</i><br
/>
+ <br />
+
+ Bye!
+ </center>";
+}
+
$ip_spam_lookup_url = 'http://www.dnsbl.info/lookup.asp?IP=';
$_SERVER['BASE_PAGE'] = 'manual/add-note.php';
@@ -8,6 +42,7 @@
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/posttohost.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
include $_SERVER['DOCUMENT_ROOT'] . '/manual/spam_challenge.php';
+include
site_header("Add Manual Note");
// Copy over "sect" and "redirect" from GET to POST
Added: web/php/trunk/manual/include/spam-func.php
===================================================================
--- web/php/trunk/manual/include/spam-func.php (rev 0)
+++ web/php/trunk/manual/include/spam-func.php 2010-04-27 16:05:25 UTC (rev 298665)
@@ -0,0 +1,28 @@
+<?php
+/* $Id: */
+/**
+ * Simple SPAM control functions.
+ * 27-APR-2010 <danbrown>
+ */
+
+
+/**
+ * Block specific static IP addresses known to do nothing
+ * but make our lives more difficult. 27-APR-2010 <danbrown>
+ * Expects: $ip
+ * Returns: $ip on blacklist, false on clear.
+ */
+function kill_spammer($ip) {
+
+ // Bad IPs
+ $bad = array(
+ '66.51.252.15',
+ );
+
+ // If the IP is blocked, return the IP address.
+ if (in_array($ip,$bad)) {
+ return $ip;
+ }
+
+ return false;
+}