[Pmwiki-users] email protection

Reimer Behrends behrends
Wed Feb 25 19:07:39 CST 2004


On Wed, Feb 25, 2004 at 06:04:04PM -0500, Reimer Behrends wrote:
[...]
> See below for a solution that uses a very simple obfuscation
> technique. It should be easy to extend it to different things.
> Caveat: Currently it's only been tested with pmwiki 0.5.

Just to follow up on my own post: Obviously, if you want to obfuscate
emails, you also need to ban spam harvesters from seeing the source (can
happen when $action is "edit", "source", or "diff"). Otherwise all the
obfuscation won't help. My current approach is to set a cookie and check
for it, assuming that email harvesters won't accept cookies:

The code below goes in your local.php file. You want to change the
cookie name from "Visited" to something random and the cookie path to
the actual path of your Wiki. (Someday I'm going to make it return a 404
status code, too.)

			Reimer Behrends


$BotBlockCookie = "Visited";
$BotCookiePath = "/";
setcookie($BotBlockCookie, "-", 0, $BotCookiePath);
if (($action == "edit" || $action == "source" || $action == "diff") &&
    !$_COOKIE[$BotBlockCookie])
{
  Abort("You must have cookies enabled to perform this action. " .
    "Our pages set a simple cookie that prevents email harvesters " .
    "and other spiders from accessing certain parts of our site. " .
    "In order to edit a page or view page revisions, please enable " .
    "cookies and reload this page twice (once to set the cookie, the " .
    "second time to perform the action)");
}




More information about the pmwiki-users mailing list