WordPress:Protection From Harvesters

来自站长百科
Fludlen讨论 | 贡献2008年6月20日 (五) 17:33的版本
跳转至: 导航、​ 搜索

E-mail spammers often use programs, known as e-mail harvesters, that scan pages on the Internet for e-mail addresses to collect and send unsolicited e-mail. If your e-mail address is publicly available through your WordPress installation, it may be vulnerable to these kinds of programs. Below are a few simple ways you can protect yourself from spam while still providing an e-mail address to your readers.

电子邮件spammers经常使用一个称之为电子邮件harvesters的程序,这个程序可以扫描因特网上的网页,收集上面的电子邮件地址并且发送没有得到允许的电子邮件。如果在WordPress安装过程中,你的电子邮件地址对外开放,可能就会容易收到这种程序的袭击。下面提供一些方法,使你能够,在你给读者提供你的电子邮件的同时,免受垃圾广告的袭击。

Substitute Email Address

替换电子邮件地址

A popular solution to e-mail harvesting is to create a "throwaway" e-mail address at free services such as GMail or Yahoo Mail. Set this as your e-mail address in your profile. WordPress makes it easy to display the address on your blog by providing the template tag the_author_email(). Within WordPress:The Loop portion of your templates, just add the tag:

一个流行的解决电子邮件harvesting 的方法是在免费服务如GMail或者 Yahoo Mail上创建一个"throwaway"电子邮件地址。在你的个人基本资料上,将这个电子邮件地址设置为你的电子邮件地址。通过提供模板标签 _作者_电子邮件(),WordPress能够轻易地在你的博客上显示地址。在你的模板的The Loop部分,只要添加标签:

<?php the_author_email(); ?>

<?php the_author_email(); ?>

You will be able to check e-mail that is specifically sent from your readers. If spam becomes too much of a problem, simply delete this account, create a new one, and change the e-mail address in your profile to the new address. Your site will be immediately updated without having to change any template files.

你就能够查看你的读者发送的电子邮件。如果垃圾邮件变成了一个大问题,只要删除这个帐户,创建一个新的帐户,并且在你的基本资料中将电子邮件地址更改为一个新的地址。你的站点就会立马更新,不会更改任何的模板文件。

Disguising Your Email

掩饰你的电子邮件

To "fool" e-mail harvesters, a simple method is to convert the symbols in an e-mail address to words (typically parenthesized). For example, steve@mac.com becomes steve (at) mac (dot) com. Since this is not recognized as a valid e-mail format, harvesters tend to ignore it.

要"欺骗"电子邮件harvesters,一个简单的方法就是将电子邮件中的符号转变为单词(一般更改后,单词放括号中)。例如,steve@mac.com 变成了 steve (at) mac (dot) com。因为更改后的形式,一般被看做是一个无效的电子邮件形式,harvesters就会试图忽略这个电子邮件地址。

A slightly more complicated approach is to transform or encode characters in an address to their HTML character entity, or numeric character reference, equivalent. This means the letter a in an address becomes &#97;, the @ symbol &#64;, and so on. These should appear as gobbledygook to harvesters, while your browser renders them correctly.

一个稍微复杂的方法是将一个电子邮件地址中的字符转变或者编码为字符的HTML 字符实体,或者数字字符参考,等同物。这意味着,电子邮件地址中的a变为了&#97;, @符号变为了&#64;,等等。对于这些,harvesters读作了官样文章,但是你的浏览器会正确地读出这些字符。

You can use a free online encoder to encode your email address or use the antispambot() function built into WordPress:

你可以使用一个在线免费编码器来给你的电子邮件地址编码,或者将antispambot() 函数置入WordPress中。

<?php echo antispambot(get_the_author_email()); ?>

<?php echo antispambot(get_the_author_email()); ?>

The function antispambot() above parses the e-mail address passed by get_the_author_email() (this is the same as the_author_email(), except it returns rather than displays the author's e-mail address). Use of the echo command displays the output of antispambot(). An interesting feature is it encodes only portions of an address, and does so randomly so the letters encoded are different each time the page loads, adding a little more firepower to the spam protection arsenal.

上面的antispambot()函数解析了电子邮件地址,这个地址是由get_the_author_email()传递的(这个与 the_作者_电子邮件()相同, 只是这个函数返回而不是显示了作者的电子邮件邮件地址)。使用echo命令行显示了antispambot()的产出。一个有趣的特点是它指示给电子邮件地址的某一部分编码了,是任意地编码的,这样每次网页载入的时候,编码的字母都是不同的,给预防垃圾广告火力库添加了一些火力。

NOTE: Unfortunately, WordPress does not allow invalidly formatted e-mail addresses to be used in one's profile, so obfuscating your e-mail address there will not work.

注:不幸的是,WordPress不允许一个人的基本资料中使用无效格式的电子邮件地址,因此将你的使你的电子邮件地址格式变得模棱两可,这种方法可能不适用。