自制wordpress 反垃圾评论程序
星期四, 1月 7th, 2010忍了好久了,三天两头收到垃圾留言,趁今天博客大改造,顺便改了评论代码
首先是主题里的comment.php文件,在website和</small>之间插入以下代码
| 1+1=<input type=”radio” name=”antispam” value=”0″>1?<input type=”radio” name=”antispam” value=”1″>2!
然后在博客根目录下的wp-comments-post.php文件,wp_die( __(’Sorry, you must be logged in to post a comment.’) );之后}之前,插入
if (!$_POST['antispam'])
wp_die(__(’Error:please select the right answer!’));
这样,访客就必须先完成1+1=2,才能留言了,相信应该有效果,不过不是100%防御,查代码的时候还看到有说关闭了评论还被留言的情况,可见垃圾留言群发机攻击力之强大啊…
睡觉…