ÓÉÓÚ¸oÈ˲(C)¿ÍСվµÄ¿Õ¼aÓemysql¿Õ¼aÍuÍuÓÐÏÞ£¬¹²Ïi*þÎñÆ÷×ÊÔ´Ò²ÓÐÏÞ£¬ËuÒÔÀ¬»øÆÀÂÛÒ»¶¨ÒªÀ¹½ØÔÚдÈeÊý¾Ý¿aÖ®Ía¡£
¸u¿ÉÆøµÄÊÇ¿´µ½¿Õ¼aµÄͳ¼Æ£¬ºÜ¼¸Ç§µÄIP*ÃÎÊ£¬µ«»u±¾É϶¼ÊÇÕa¸oÀ¬»øÆÀÂÛµÄIP£¬ËuÒÔʵÔÚ²»ÄÜÈÌ
ÍøÉÏÕÒÁËÒ»Ð(C)½¨£¬Ö÷ÒªÓÐÈý¸o£¬Èç¹u½«ÕaÈý¸oÒ»¿eʹÓûu±¾ÉϾͿÉÒÔÀ¹½Ø¾ø´o¶aÊýÀ¬»øÆÀÂÛ
Ò»¡¢Ê¹ÓÃAkismet²a¼þ£¨https://wordpress.org/plugins/akismet/£(C)£¬ºǫÉeÇeÒ»¸oÃaѵÄkey£¬¿ÉÒÔÀ¹½Ø99%µÄÀ¬»øÆÀÂÛ£¬µ«ÊÇÕa¸o²a¼þ»¹ÊÇ»a½«À¬»øÆÀÂÛдÈeÊý¾Ý¿aµÄ£¬Ò»»a¼¸Ç§ÌoÉoÖÁÉÏÍoÌoÀ¬»øÆÀÂÛ£¬Ëa˵¿ÉÒÔÉeÖÃ15Ìiºo×Ô¶¯É¾³ý£¬µ«ÊÇ¿´×ÅÒ²±ðŤ£¬ÓÚÊǼÓÉϵڶþÖÖ½*¨¡£
¶þ¡¢¸u¸Äwp-comments-post.phpÃu³Æ
ÕaÖÖ½¨ÊÇÏȽ«wp-comments-post.php¸ÄΪËae±aµÄÃu×Ö£¬È»ºoÔÚÄaÖ÷ÌaÎļþµÄcomments.phpÖн«wp-comments-post.php¸ÄΪÄa¸Õ²Å¸Ä¹ýµÄÃu×Ö
µ«ÊÇÏÖÔÚµÄspam»uÆ÷ÈËÌ«Ç¿ÁË£¬ÕaÖÖ½¨»u±¾ÉÏûÓÐÈκÎ×÷Óã¬À¬»øÆÀÂÛ»¹ÊÇ»a½øÈeµ½ºǫµÄÀ¬»øÆÀÂÛÀi£¬ÓÚÊDzÉÈ¡µÚÈýÖÖ½¨£¬¹ýÂ˵o´¿Ó¢ÓiµÄÀ¬»øÆÀÂÛ£¬ÕaÖÖÆÀÂÛÕ¼ÁËÀ¬»øÆÀÂ۵ĺܴoÒ»²¿*Ö
Èý¡¢¹ýÂË´¿Ó¢ÎÄÀ¬»øÆÀÂÛ
ÔÚÄaÖ÷ÌaµÄfunctions.phpÖÐÌi¼ÓÒÔÏ´uÂe
function refused_spam_comments( $comment_data ) {
$pattern = '/[Ò»-ý›]/u';
if(!preg_match($pattern,$comment_data['comment_content'])) {
wp_die('ÆÀÂÛ±ØÐeº¬ÖÐÎÄ£¡');
}
return( $comment_data );
}
add_filter('preprocess_comment','refused_spam_comments');
ÆaÖÐ[Ò»-ý›]Õa¸oÕýÔo±i´iʽ´u±iËuÓÐÖÐÎÄ£¬Õaʱ´¿Ó¢ÎĵÄÀ¬»øÆÀÂÛËaÊǹýÂ˵oÁË£¬µ«ÊÇ»¹ÓÐÁiÍaÒ»ÖÖÀ¬»øÆÀÂÛ£¬ÈÕÎĵġ¡
ÈÕÎĵIJÉÓÃͬÑuµÄ½¨£¬Çe¼¸¸o³£³oÏÖµÄÈÕÎļÙÃuдÈeµ½ÕýÔo±i´iʽÖХᢤΡ¢¥o¡¢ƒž¡¢˜I¡¢¥°¡¢ÙQ
function fuckjp_comment_post( $incoming_comment ) {
$http = '/[<|=|.|ÓÑ|Ò¹|KTV|¥Ã|¤Î|¥o|ƒž|˜I|¥°|ÙQ|]/u';
if(preg_match($http, $incoming_comment['comment_content'])) {
wp_die( "ÈÕ±¾¹a¸aeÀe¿ª!" );
}
return( $incoming_comment );
}
add_filter('preprocess_comment', 'fuckjp_comment_post');